package com.ymatou.iapi.productsync.testcase.old20210127;
import com.google.common.collect.Lists;
import com.mongodb.BasicDBObject;
import com.shop2cn.iapi.activitymgt.parameter.AddactivityBean;
import com.shop2cn.iapi.grouponmgr.parameter.SaveGrouponReq;
import com.shop2cn.iapi.agentproducts.parameter.*;
import com.shop2cn.iapi.agentproducts.service.*;
import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateCollectionGoodsAddressBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateFreightTemplateBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.parameter.listagentTypeBean;
import com.ymatou.iapi.godmch.service.listagentTypeCall;
import com.ymatou.iapi.godmch.service.removemchCall;
import com.ymatou.iapi.liveseller.parameter.CreateLiveActivityBean;
import com.ymatou.iapi.liveseller.parameter.CreateSellerLiveBean;
import com.ymatou.iapi.liveseller.parameter.ModifyLiveActivityBean;
import com.ymatou.iapi.liveseller.service.ModifyLiveActivityCall;
import com.ymatou.iapi.prodstock.parameter.AgentProductPo;
import com.ymatou.iapi.prodstock.parameter.AuditProductActivityStockBean;
import com.ymatou.iapi.productmanager.parameter.SaveGrouponBean;
import com.ymatou.iapi.productmanager.parameter.SaveProductTemplateBean;
import com.ymatou.iapi.productmanager.parameter.SetPspStatusBean;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productmanager.parameter.product.ModifySellerProductRequest;
import com.ymatou.iapi.productmanager.service.ModifySellerProductCall;
import com.ymatou.iapi.productmanager.service.SaveProductTemplateCall;
import com.ymatou.iapi.productmanager.service.SetPspStatusCall;
import com.ymatou.iapi.productmanager.service.UpdateProductSensitiveWordCall;
import com.ymatou.iapi.productquery.parameter.GetProductInfoByProductIdBean;
import com.ymatou.iapi.productquery.service.GetProductInfoByProductIdCall;
import com.ymatou.iapi.productsync.parameter.MongocrudBean;
import com.ymatou.iapi.productsync.service.MongocrudCall;
import com.ymatou.iapi.productsynces.parameter.ESsearchBean;
import com.ymatou.iapi.productsynces.parameter.es.EsGodProduct;
import com.ymatou.iapi.productsynces.service.ESGodsearchCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.annotation.SqlMapperFactory;
import com.ymttest.database.annotation.product.IntergratedProductMapper;
import com.ymttest.database.model.*;
import com.ymttest.database.model.anlihui.YmtAnlihuiProduct;
import com.ymttest.database.mongo.jproduct.*;
import com.ymttest.database.redis.ImRedisWapper;
import com.ymttest.database.sqlwapper.*;
import com.ymttest.database.sqlwapper.anlihui.YmtAnlihuiProductWrapper;
import com.ymttest.database.sqlwapper.godfreight.freight_templateWapper;
import com.ymttest.utils.*;
import com.ymttest.utils.DataUtil.Json;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

public class Ts_Mongocrud {
	private static MongocrudBean bean;
	private static MongocrudCall call;
	private static YmtProductActivityStockWapper productActStockWapper=new YmtProductActivityStockWapper();
	private static ModifyLiveActivityBean modifyliveactivityBean=new ModifyLiveActivityBean();
	private static ModifyLiveActivityCall modifyliveactivityCall=new ModifyLiveActivityCall();
	private static int sellerId = Integer.parseInt(EnvSetup.getData("autotest_seller1"));
	private static int globalSellerId = Integer.parseInt(EnvSetup.getData("globalSellerId"));
	private static String globalSellerName = EnvSetup.getData("globalSellerName").toString();
	private static String sellerName2 = EnvSetup.getData("productsellername");
	private static int sellerId2 = Integer.parseInt(EnvSetup.getData("productsellerid"));
	private static String activityStartId = EnvSetup.getData("productActivityStartId");
	private static String activityUser = EnvSetup.getData("AdminLoginUser");
	private static String activityPswd = EnvSetup.getData("AdminLoginPswd");
	private static int sellerId3 = Integer.parseInt(EnvSetup.getData("SellerId"));//3383
	
	private static ActivityProductsWapper productActivityStockWapper=new ActivityProductsWapper();
	private static ActivityProductsWapper activityProductsWapper=new ActivityProductsWapper();
	private  ProductTimeStampWapper productTimeStampWapper=new ProductTimeStampWapper();
	private static ProductsWapper mongoDB_productsWapper=new ProductsWapper();
	private static ProductDescExtraNewWapper productDescExtraWapper=new ProductDescExtraNewWapper();
	private static LiveProductsWapper liveProductWapper=new LiveProductsWapper();
	private static LiveRoomWapper liveRoomWapper=new LiveRoomWapper();
	private static YmtCatalogsWapper catalogdWapper=new YmtCatalogsWapper();
	private static YmtProductsWapper productMapper=new YmtProductsWapper();
	private static YmtProductsWapper ymtproductsWapper=new YmtProductsWapper();
	private static IntergratedProductMapper ipm = SqlMapperFactory
            .getIntergratedProductMapper();
	
	private static YmtProductsInActivityWapper productInActivityWapper=new YmtProductsInActivityWapper();
	private YmtActivityWapper ymtActivityWapper=new YmtActivityWapper();
	private YmtCatalogsIWapper CIWapper = new YmtCatalogsIWapper();
	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
	private 		ImRedisWapper imRedisWapper=new ImRedisWapper();
	private YmtProductActivityStockWapper ymtProductActivityStockWapper=new YmtProductActivityStockWapper();
	private  YmtProductsIWapper YmtProductsIWapper =new YmtProductsIWapper();
	private GrouponProductsWapper mongoDB_grouponProductsWapper=new GrouponProductsWapper();
	private ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
	private ESsearchBean esbean=new ESsearchBean();
	private ESGodsearchCall godCall=new ESGodsearchCall();
//	private AddAgentProductBean addAgentProductBean;
	
	//渠道商
	private static int sellerId1 = AgentUsers.rootUserId;
	private static String sellerName1 = "NickautoTest";
	//代理商1
	private static int agentUserId1 = AgentUsers.agentUserId1;
	private static String agentUserName1 = "NickautoTest";
	//代理商2
	private static int agentUserId2 = AgentUsers.agentUserId2;
	private static String agentUserName2 = "NickautoTest";
	private static AddAgentProductCall addagentproductCall=new AddAgentProductCall();
	//渠道商->代理商1
	private static int mch_agentUserId1 = AgentUsers.agentUserId1;
	private static String mch_agentUserName1 = "NickautoTest";
	
	//vip渠道
	private static int vipRootUserId = AgentUsers.vipRootUserId;
	private static String vipRootUserName = "NickautoTest";
	//vip渠道->代理
	private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
	private static String vipAgentUserName1 = "dgsq408897016";
	//vip渠道->代理->代理
	private static int vipAgentUserId2 = AgentUsers.vipAgentUserId2;
	private static String vipAgentUserName2 = "NickautoTest";
	
	
	//境内渠道商
	private static int domestic_sellerId = 500772053;
	private static String domestic_sellerName = "NickautoTest";
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("同步mongo");
	}
	
	@Before
	public void caseUp() {
		bean = new MongocrudBean();
		call = new MongocrudCall();	
	}
	
	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}
	
	@After
	public void caseDown() {
		Logger.end();
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_001() {
		Logger.start(true,"同步mongo-验证指令SyncLiveActivityProduct,直播商品秒杀活动");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			Logger.comment("查询商品规格");

			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			List<String> cids = catalogsList.stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			Logger.comment("创建秒杀活动");
			CreateLiveActivityBean createliveactivityBean = LiveRoomCallService.initCreateLiveActivityBean(createlive.getId(), cids.get(0), 5d, 6, starttime);
			LiveRoomCallService.CreateLiveActivity(createliveactivityBean);	
			
			modifyliveactivityBean=LiveRoomCallService.initModifyLiveActivityBean(createliveactivityBean);
			//修改结束时间
			modifyliveactivityBean.getLiveActivity().setEndTime(String.valueOf(new Date(now.getTime() + 201 * 60 * 1000).getTime()));
//			//修改价格和库存
//			modifyliveactivityBean.getLiveActivity().getActivityProducts().forEach(ap->{
//				ap.setActivityStock(ap.getActivityStock()-1);
//				ap.setActivityPrice(ap.getActivityPrice()-1);
//			});
			modifyliveactivityCall.setData(modifyliveactivityBean);
			modifyliveactivityCall.callService();
			
			//修改
			int iActivityID=modifyliveactivityBean.getLiveActivity().getLiveActivityId();
			int productInActivityId=modifyliveactivityBean.getLiveActivity().getActivityProducts().get(0).getActivityProductId();
			int transactionId=TestDataManager.getRandomIntNum(9);
			int stockNum=TestDataManager.getRandomIntNum(1);

			Map map=productActStockWapper.selectBy(MapUtil.hashMap("sproductid",productId,"iactivityid",iActivityID));
			int count=productActStockWapper.updateiStockNumByProductActivityStockId(map.get("sProductActivityStockID").toString(),stockNum);
			
			int source=Integer.parseInt(map.get("sourceId").toString())+1;
			
			productActStockWapper.updateSourceIdByProductActivityStockId(map.get("sProductActivityStockID").toString(),source);
			Logger.comment("stockNum######:"+stockNum);
	       
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("SyncLiveActivityProduct");
			bean.setActivityId(productInActivityId);//Ymt_ProductActivityStock 表中的 iProductInActivityId
			bean.setProductId(productId);
			bean.setTransactionId(transactionId);
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= productActivityStockWapper.getByProdId(productId);
			
			Logger.verifyEquals(new JSONArray(p.get("catalogs").toString()).getJSONObject(0).getString("stock")
					, Integer.toString(stockNum), "验证mongo返回的库存");
			Logger.verifyEquals(p.get("atype").toString(), "1", "验证atype返回的库存");
			Logger.verifyEquals(p.get("sourceId"), source, "验证sourceId返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyNotNull(ob.get("aut"), "验证aut活动商品更新时间不为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			
			//YmtProductsInActivity  productsInActivity=productInActivityWapper.selectAllByiActivityId(activityId).get(0);
			//Logger.verifyEquals(true,(long)ob.get("aut")>sdf.parse(map.get("dUpdateTime").toString()).getTime(), "验证aut活动商品更新时间");

			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
		    long aut_mongo=sdf.parse(sdf.format(map2.get("aut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("aut"),aut_mongo, "验证redis aut规格更新时间与mongo一致");

		}catch(Exception e){
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_002() {
		Logger.start(true,"同步mongo-验证指令CreateProduct,新增商品");
		try{	
			//发布一个商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductType(3);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			
			bean.setActionType("CreateProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean); 
			call.callService();
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(addpro.getProduct().getProductType(),Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}	
            
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			
			System.out.println("Redis cut:"+sdf.format(new Date(Long.valueOf(ob.get("cut").toString()))));
			System.out.println("Redis sut:"+sdf.format(new Date(Long.valueOf(ob.get("sut").toString()))));

			Map<String,Object> map = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map.get("sut"))).getTime();
		    
			System.out.println("mongo cut:"+sdf.format(map.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map.get("sut")));

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			//拼邮发货类型
            YmtProducts product=productMapper.selectProductByProductId(productId); productMapper.selectProductByProductId(productId);
            Logger.verifyEquals(p.get("pdt"),product.getPackageDeliveryType(), "验证数据库ymtproduct拼邮发货类型与mongo一致");
    		
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_002_1() {
		Logger.start(true,"同步mongo-验证指令CreateProduct,新增商品-全球优选商品");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");

			bean.setActionType("CreateProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");
            
            YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}	
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_002_2() {
		Logger.start(true,"同步mongo-验证指令CreateProduct,新增商品-大礼包");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(globalSellerId,productId,1);
			//同步商品
			createProduct_sync(productId);
			Logger.verifyNotNull(productId, "响应报文-商品ID");

			bean.setActionType("CreateProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("gtype").toString()),
            		"验证传入的商品类型gtype与mongo是否一致");
            
            YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}	
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_003() {
		Logger.start(true,"同步mongo-验证指令ModifyProduct,修改商品");
		try{
			YmtProductsWapper productWapper=new YmtProductsWapper();
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String endTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(7), 0);
			
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
            //创建商品同步指令
			createProduct_sync(productId);
			
			Logger.comment("productId:"+productId);
			YmtProducts products=productWapper.selectProductByProductId(productId);
			//修改 
			String productName="测试mongo同步_"+startTime;
			addpro.getProduct().setProductName(productName);
			addpro.getProduct().setRecomReason("修改推荐理由_"+TestDataManager.getRandomNum(2));;
			addpro.setProductSite("APP");
 			ProductManagerCallServiceV3.ModifySellerProduct(productId,addpro);

			bean.setActionType("ModifyProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Logger.comment("RecomReason:"+addpro.getProduct().getRecomReason());
			 //验证商品名称title
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("title").toString(), productName, "验证mongo返回的title");
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}	
           
            YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
 			//查询规格上的佣金
			BasicDBObject search = new BasicDBObject();
			search.append("spid", productId);
			// 验证规格相关
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			Logger.verifyEquals(null,clist.get(0).get("commissionpercent"),"验证佣金commissionpercent");
			
			//RecomReason 推荐理由（目前主要用在直播商品列表） 新增 wuwen 20200213 
			Logger.verifyEquals(p.get("recomreason").toString()
					, addpro.getProduct().getRecomReason(), "验证mongo返回的推荐理由");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}

	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_003_1() {
		Logger.start(true,"同步mongo-验证指令ModifyProduct,修改商品-spu商品");
		try{
			YmtProductsWapper productWapper=new YmtProductsWapper();
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String endTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(7), 0);
			
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerSpuProduct(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			//移除一个规格
			//addpro.getProduct().getCatalogList().remove(1);
			
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//spu商品编号 sppid
		//	addpro.getProduct().setSpuProductId(TestDataManager.getRandomIntNum(5));
			addpro.getProduct().setSpuId(229);
			addpro.getProduct().setSpuProductId(229);
			
			//spuCatalogId标准商品库规格id spcid
			addpro.getProduct().getCatalogList().get(0).setSpuCatalogId(11);
			//publishType 发布类型 0- 标准商品，1- 图片商品，2- 视频商品 pubtype
			addpro.getProduct().setPublishType(1);
			//ProductTags 选填，商品标签列表 tag 
			addpro.getProduct().setProductTags(Lists.newArrayList("Tags1","Tags2"));
			
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
            //创建商品同步指令
			createProduct_sync(productId);
			
			Logger.comment("productId:"+productId);
			YmtProducts products=productWapper.selectProductByProductId(productId);
			//修改 
			String productName="测试mongo同步_"+startTime;
			addpro.getProduct().setProductName(productName);
			addpro.getProduct().setRecomReason("修改推荐理由_"+TestDataManager.getRandomNum(2));;
			addpro.setProductSite("APP");
			
			//新增20200521
			//spuCatalogId标准商品库规格id spcid
			addpro.getProduct().getCatalogList().get(0).setSpuCatalogId(22);
			//publishType 发布类型 0- 标准商品，1- 图片商品，2- 视频商品 pubtype
			addpro.getProduct().setPublishType(2);
			//ProductTags 选填，商品标签列表 tag 
			addpro.getProduct().setProductTags(Lists.newArrayList("uTags1","uTags2"));
			
			//addpro.getProduct().setSpuProductId(TestDataManager.getRandomIntNum(5));
			
 			ProductManagerCallServiceV3.ModifySellerProduct(productId,addpro);

			bean.setActionType("ModifyProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			//bean.setProductId("p4239977");
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Logger.comment("RecomReason:"+addpro.getProduct().getRecomReason());
			 //验证商品名称title
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("title").toString(), productName, "验证mongo返回的title");
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}	
           
            YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
 			//查询规格上的佣金
			BasicDBObject search = new BasicDBObject();
			search.append("spid", productId);
			// 验证规格相关
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			Logger.verifyEquals(null,clist.get(0).get("commissionpercent"),"验证佣金commissionpercent");
			
			
			//新增20200521
			Logger.verifyEquals(p.get("sppid").toString()
					, addpro.getProduct().getSpuProductId().toString(), "验证mongo返回的spu商品编号");
			//publishType 发布类型 0- 标准商品，1- 图片商品，2- 视频商品 pubtype
			Logger.verifyEquals(p.get("pubtype").toString()
					, addpro.getProduct().getPublishType().toString(), "验证mongo返回的发布类型 0- 标准商品，1- 图片商品，2- 视频商品");
			//ProductTags 选填，商品标签列表 tag 
			Logger.verifyEquals(new JSONArray(p.get("tag").toString()).length(), addpro.getProduct().getProductTags().size(), "验证传入的数据与返回的一致");
			for(int i=0;i<new JSONArray(p.get("tag").toString()).length();i++)
			{
				String tag=new JSONArray(p.get("tag").toString()).getString(i);
				Logger.verifyEquals(true
						, addpro.getProduct().getProductTags().contains(tag), "验证mongo返回的商品标签列表");
			}
			Logger.verifyEquals(clist.get(0).get("spcid").toString()
					, addpro.getProduct().getCatalogList().get(0).getSpuCatalogId().toString(), "验证mongo返回的spuCatalogId标准商品库规格id");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_003_2() {
		Logger.start(true,"同步mongo-验证指令ModifyProduct,修改商品-奢侈品、物流(20201202排查-买手没有当前的物流方式发布权限)");
		try{
			YmtProductsWapper productWapper=new YmtProductsWapper();
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String endTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(7), 0);
			//发布商品
			/*奢侈品
			 * 类目 1001  1002  1003
                                     品牌 10187
                                      价格在1000-99999之间
			 */
			AddSellerProductRequest addpro =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addpro.getProduct().getCatalogList().get(0).setPrice(10000);
			addpro.getProduct().getCatalogList().get(0).setNewPrice(10000);
			addpro.getProduct().getCatalogList().get(0).setVipPrice(10000);
			addpro.getProduct().getCatalogList().get(0).setMarketPrice(18000);
            //物流时效
		    addpro.getProduct().setDeliveryCompanyType(1);
			addpro.getProduct().setDeliveryAging(5);
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			Logger.verifyNotNull(productId, "响应报文-商品ID");
            //创建商品同步指令
			createProduct_sync(productId);
			
			Logger.comment("productId:"+productId);
			YmtProducts products=productWapper.selectProductByProductId(productId);
			//修改 
			addpro.getProduct().setBrandId(13540);
			addpro.getProduct().getCatalogList().get(0).setPrice(60);
			addpro.getProduct().getCatalogList().get(0).setNewPrice(60);
			addpro.getProduct().getCatalogList().get(0).setVipPrice(60);
			addpro.getProduct().getCatalogList().get(0).setMarketPrice(60);
			
			addpro.getProduct().setDeliveryCompanyType(2);
			//addpro.getProduct().setDeliveryAging(10);
 			ProductManagerCallServiceV3.ModifySellerProduct(productId,addpro);
			bean.setActionType("ModifyProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Logger.comment("RecomReason:"+addpro.getProduct().getRecomReason());
			 //验证商品
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals("false",p.get("lux").toString(), "验证mongo返回的lux=true:是奢侈品");
			Logger.verifyEquals(addpro.getProduct().getDeliveryCompanyType(),Integer.parseInt(p.get("dct").toString()), "验证mongo返回的dct   1.官方 2.三方");
			Logger.verifyEquals(addpro.getProduct().getDeliveryAging(),Integer.parseInt(p.get("da").toString()), "验证mongo返回的da 	 时效 天 5,10,15");
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_004() {
		Logger.start(true,"同步mongo-验证指令UpdateLiveTimeForEs,更新扫货线程的商品直播时间");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			LiveRoomCallService.UpdateLiveTimeToStart(createlive.getId());
			
//			Logger.comment("查询商品规格");
//			YmtCatalogsIWapper CIWapper = new YmtCatalogsIWapper();
//			List<String> cids = CIWapper.selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
//			Logger.comment("创建秒杀活动");
//			CreateLiveActivityBean createliveactivityBean = LiveRoomCallService.initCreateLiveActivityBean(createlive.getId(), cids.get(0), 5d, 6, starttime);
//			LiveRoomCallService.CreateLiveActivity(createliveactivityBean);	
//			
//			modifyliveactivityBean=LiveRoomCallService.initModifyLiveActivityBean(createliveactivityBean);
			//修改结束时间
//			modifyliveactivityBean.getLiveActivity().setEndTime(String.valueOf(new Date(now.getTime() + 201 * 60 * 1000).getTime()));
//			//修改价格和库存
//			modifyliveactivityBean.getLiveActivity().getActivityProducts().forEach(ap->{
//				ap.setActivityStock(ap.getActivityStock()-1);
//				ap.setActivityPrice(ap.getActivityPrice()-1);
//			});
//			modifyliveactivityCall.setData(modifyliveactivityBean);
//			modifyliveactivityCall.callService();
			
		   //获取商品在直播中的Id
			Map map=new LiveRoomWapper().selectLiveproductByLiveid(createlive.getId()).get(0);
			int liveProductId=Integer.parseInt(map.get("LiveProductId").toString());
			Logger.comment("liveProductId："+liveProductId);
	       
			//修改库存stock
			Thread.sleep(10000);
			bean.setActionType("UpdateLiveTimeForEs");
			bean.setActivityId(liveProductId);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
//	        //验证库存stock
//		    Map<String,Object> p= productActivityStockWapper.getByProdId(productId);
//			
//			Logger.verifyEquals(new JSONArray(p.get("catalogs").toString()).getJSONObject(0).getString("stock")
//					, Integer.toString(stockNum), "验证mongo返回的库存");
//			Logger.verifyEquals(p.get("atype").toString(), "1", "验证atype返回的库存");
//			Logger.verifyEquals(p.get("sourceId"), source, "验证sourceId返回的库存");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_005() {
		Logger.start(true,"同步mongo-验证指令AddProduct,添加商品（批量）");
		try{
			//RecomReason 推荐理由（目前主要用在直播商品列表）
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
	       
			bean.setActionType("AddProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			//修改库存stock
			//Thread.sleep(5000);
			
			call.setData(bean);
			call.callService();
			Logger.comment("RecomReason:"+addpro.getProduct().getRecomReason());
	        //验证
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			
			Logger.verifyEquals(p.get("spid").toString()
					, productId, "验证mongo返回的商品id");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			//查询规格上的佣金
			BasicDBObject search = new BasicDBObject();
			search.append("spid", productId);
			// 验证规格相关
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			Logger.verifyEquals(null,clist.get(0).get("commissionpercent"),"验证佣金commissionpercent");
			//RecomReason 推荐理由（目前主要用在直播商品列表） 新增 wuwen 20200213 
			Logger.verifyEquals(p.get("recomreason").toString()
					, addpro.getProduct().getRecomReason(), "验证mongo返回的商品id");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_005_1() {
		Logger.start(true,"同步mongo-验证指令AddProduct,添加商品（批量）-spu商品");
		try{
			//RecomReason 推荐理由（目前主要用在直播商品列表）
			//AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerSpuProduct(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			/*
			 * 新增字段：商品发布类型 pubtype
				新增字段：sppid（Ymt_Products.SpuProductId）
				新增字段：tag （Ymt_ProductTag）
				新增字段：as（AuditStatus）
			 */
			//spu商品编号 sppid
		//	addpro.getProduct().setSpuProductId(TestDataManager.getRandomIntNum(5));
			//spuCatalogId标准商品库规格id spcid
			addpro.getProduct().getCatalogList().get(0).setSpuCatalogId(11);
			//publishType 发布类型 0- 标准商品，1- 图片商品，2- 视频商品 pubtype
			addpro.getProduct().setPublishType(1);
			//ProductTags 选填，商品标签列表 tag
			addpro.getProduct().setProductTags(Lists.newArrayList("Tags1","Tags2"));
			
			 
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
	       
			bean.setActionType("AddProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			//修改库存stock
			//Thread.sleep(5000);
			
			call.setData(bean);
			call.callService();
			Logger.comment("RecomReason:"+addpro.getProduct().getRecomReason());
	        //验证
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			
			Logger.verifyEquals(p.get("spid").toString()
					, productId, "验证mongo返回的商品id");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			//查询规格上的佣金
			BasicDBObject search = new BasicDBObject();
			search.append("spid", productId);
			// 验证规格相关
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			Logger.verifyEquals(null,clist.get(0).get("commissionpercent"),"验证佣金commissionpercent");
            //新增20200521
			Logger.verifyEquals(p.get("sppid").toString()
					, addpro.getProduct().getSpuProductId().toString(), "验证mongo返回的spu商品编号");
			
			//publishType 发布类型 0- 标准商品，1- 图片商品，2- 视频商品 pubtype
			Logger.verifyEquals(p.get("pubtype").toString()
					, addpro.getProduct().getPublishType().toString(), "验证mongo返回的发布类型 0- 标准商品，1- 图片商品，2- 视频商品");
			
			//ProductTags 选填，商品标签列表 tag 
			Logger.verifyEquals(new JSONArray(p.get("tag").toString()).length(), addpro.getProduct().getProductTags().size(), "验证传入的数据与返回的一致");
			for(int i=0;i<new JSONArray(p.get("tag").toString()).length();i++)
			{
				String tag=new JSONArray(p.get("tag").toString()).getString(i);
				Logger.verifyEquals(true
						, addpro.getProduct().getProductTags().contains(tag), "验证mongo返回的商品标签列表");
			}
			Logger.verifyEquals(clist.get(1).get("spcid").toString()
					, addpro.getProduct().getCatalogList().get(0).getSpuCatalogId().toString(), "验证mongo返回的spuCatalogId标准商品库规格id");
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_005_2() {
		Logger.start(true,"同步mongo-验证指令AddProduct,添加商品（批量）-奢侈品、物流(20201202排查-买手没有当前的物流方式发布权限)");
		try{
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().getCatalogList().get(0).setPrice(10000);
			addProdReq.getProduct().getCatalogList().get(0).setNewPrice(10000);
			addProdReq.getProduct().getCatalogList().get(0).setVipPrice(10000);
			addProdReq.getProduct().getCatalogList().get(0).setMarketPrice(18000);
            //物流时效
			addProdReq.getProduct().setDeliveryCompanyType(1);
			addProdReq.getProduct().setDeliveryAging(5);
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();

			bean.setActionType("AddProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));

			Thread.sleep(5000);
			
			call.setData(bean);
			call.callService();
	        //验证
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals("true",p.get("lux").toString(), "验证mongo返回的lux=true:是奢侈品");
			Logger.verifyEquals(addProdReq.getProduct().getDeliveryCompanyType(),Integer.parseInt(p.get("dct").toString()), "验证mongo返回的dct   1.官方 2.三方");
			Logger.verifyEquals(addProdReq.getProduct().getDeliveryAging(),Integer.parseInt(p.get("da").toString()), "验证mongo返回的da 	 时效 天 5,10,15");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_006() {
		Logger.start(true,"同步mongo-验证指令AddProductPics,添加商品图片");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
		
			List<String> productPicList=addpro.getProduct().getProductPicList();
			productPicList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_ll.jpg");
			addpro.getProduct().setProductPicList(productPicList);
			ModifySellerProductRequest modifySellerProductRequest=ProductManagerCallServiceV2.getModifySellerProductRequestFromAddProductBean(productId,addpro);
			ModifySellerProductCall modifySellerProductCall=new ModifySellerProductCall();
			modifySellerProductCall.setData(modifySellerProductRequest);
			modifySellerProductCall.callService();
			
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("AddProductPics");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    Logger.verifyEquals(new JSONArray(p.get("pics").toString()).get(new JSONArray(p.get("pics").toString()).length()-1)
					, productPicList.get(productPicList.size()-1), "验证mongo返回的图片");
			
		    
		    YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_007() {
		Logger.start(true,"同步mongo-验证指令BatchSetOnShelf,批量商品上架");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ProductManagerCallServiceV2.batchSetProductOnSale(productIds, sellerId);
			//batchSetProductOnSale
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("BatchSetOnShelf");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
//	        //验证库存stock
//		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
//		    Date dt = new Date();   
//		    SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//		    
//		    Logger.comment("newstart1:"+YMTDateUtil.getFromDTSDate(p.get("newstart").toString(),""));
//		    Logger.comment("newstart2:"+YMTDateUtil.parseYMDHMSDate(formatDate.format(dt)));
//		    Logger.verifyEquals(true, YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getFromDTSDate(p.get("newstart").toString(),""))
//		    		.before(YMTDateUtil.parseYMDHMSDate(formatDate.format(dt))), "验证newstart");

		    YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_008() {
		
		Logger.start(true,"同步mongo-验证指令UpdatePromotionName,修改报名活动名称(20201202排查-排除活动审核出错)");
		try{
			
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
            //创建商品同步指令
			createProduct_sync(productId);
			//获取规格ID
			List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			//去掉规格列表的第一个参数
			//String catalog0 = catalogs.remove(0);
			//创建一个活动  得到活动id
			Integer activityId = ProductManagerCallServiceV2.createIsolationActivityInProcess();
			
			//报名活动  获得商品在活动中的id
			List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, 100,"10");
			
			//审核通过
			ProductManagerCallServiceV2.approveProductInActivity(productId,aids.get(0),true);			
			
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String productName="修改报名活动名称指令测试_"+startTime;
			new YmtActivityWapper().updateSaleSideName(activityId,productName);	
			
			bean.setActionType("UpdatePromotionName");
			bean.setActivityId(activityId);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			 //验证mongo
		    Map<String,Object> p= activityProductsWapper.getByProdId(productId);
		    Map<String,Object> p2= productTimeStampWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("aname").toString(), productName, "验证mongo 表 activityProducts 返回的活动名称");
			Logger.verifyNotNull(p2.get("aut").toString(), "验证mongo 表 productTimeStamp 返回的uat");
			
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);

			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyNotNull(ob.get("aut").toString(), "验证aut活动商品更新时间不为空");
			
			
			System.out.println("Redis cut6:"+sdf.format(new Date(Long.valueOf(ob.get("cut").toString()))));
			System.out.println("Redis sut6:"+sdf.format(new Date(Long.valueOf(ob.get("sut").toString()))));
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map map=productActStockWapper.selectBy(MapUtil.hashMap("sproductid",productId,"iactivityid",activityId));
			
			Logger.verifyEquals(true,(long)ob.get("aut")>sdf.parse(sdf.format(map.get("dUpdateTime"))).getTime(), "验证aut活动商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map6 = productTimeStampWapper.getByProductId(productId);
			System.out.println("mongo cut6:"+sdf.format(map6.get("cut")));
			System.out.println("mongo sut6:"+sdf.format(map6.get("sut")));
			
			Map<String,Object> map7 = productTimeStampWapper.getByProductId(productId);	
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map7.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map7.get("sut"))).getTime();
		    long aut_mongo=sdf.parse(sdf.format(map7.get("aut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("aut"),aut_mongo, "验证redis aut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_009() {
		Logger.start(true,"同步mongo-验证指令DeleteProduct,删除商品");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ProductManagerCallServiceV2.batchDeleteProducts(productIds, sellerId);
			
			//batchSetProductOnSale
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("DeleteProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    Logger.verifyIsNull(p,"验证mongo没有数据");
		    YmtProducts product=productMapper.selectProductByProductId(productId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL iaction=-2");
		    
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyNotNull(ob.get("lut").toString(), "验证lut直播商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
		    long lut_mongo=sdf.parse(sdf.format(map2.get("lut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("lut"),lut_mongo, "验证redis lut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_009_1() {
		Logger.start(true,"同步mongo-验证指令DeleteProduct,删除商品-渠道商品");
		try{
			//AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			//获取商品ID
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addAgentProductBean.getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ProductManagerCallServiceV2.batchDeleteProducts(productIds, sellerId1);
			//batchSetProductOnSale
			
			Thread.sleep(5000);
			bean.setActionType("DeleteProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    Logger.verifyIsNull(p,"验证mongo没有数据");
		    YmtProducts product=productMapper.selectProductByProductId(productId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL iaction=-2");
		    
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_009_2() {
		Logger.start(true,"同步mongo-验证指令DeleteProduct,删除商品-代理商品");
		try{
			//AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			//获取商品ID
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addAgentProductBean.getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(agentProductId);
			ProductManagerCallServiceV2.batchDeleteProducts(productIds, agentUserId1);
			//batchSetProductOnSale
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("DeleteProduct");
			bean.setActivityId(0);
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
		    Logger.verifyIsNull(p,"验证mongo没有数据");
		    YmtProducts product=productMapper.selectProductByProductId(agentProductId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL iaction=-2");

			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(agentProductId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(agentProductId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(agentProductId);
			
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_010() {
		Logger.start(true,"同步mongo-验证指令DeleteProductPics,删除某个商品下的图片(单选/多选)");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
			
			List<String> productPicList=addpro.getProduct().getProductPicList();
			//List arrList = new ArrayList(productPicList);
			productPicList.remove(0);
			addpro.getProduct().setProductPicList(productPicList);
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ModifySellerProductRequest modifySellerProductRequest=ProductManagerCallServiceV2.getModifySellerProductRequestFromAddProductBean(productId, addpro);
			
			ModifySellerProductCall modifySellerProductCall=new ModifySellerProductCall();
			modifySellerProductCall.setData(modifySellerProductRequest);
			modifySellerProductCall.callService();
			
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("DeleteProductPics");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p2= mongoDB_productsWapper.getByProductId(productId);
		    
		    Logger.verifyEquals(true,new JSONArray(p1.get("pics").toString()).length()-new JSONArray(p2.get("pics").toString()).length()==1
					, "验证mongo返回的图片");
		    
		    
		    YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");

			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_011() {
		Logger.start(true,"同步mongo-验证指令ProductPutout,商品下架");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ProductManagerCallServiceV2.batchSetProductOffSale(productIds, sellerId);
			//batchSetProductOnSale
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("ProductPutout");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
//	        //验证库存stock
//		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
//		    
//		    Date dt = new Date();   
//		    SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
//		    Logger.verifyEquals(true, YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getFromDTSDate(p.get("newend").toString(),""))
//		    		.before(YMTDateUtil.parseYMDHMSDate(formatDate.format(dt))), "验证newend");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyNotNull(ob.get("lut").toString(), "验证lut直播商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//不是直播商品，为什么redis同步会更新直播时间
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			System.out.println("mongo lut:"+sdf.format(map2.get("lut")));
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
		    long lut_mongo=sdf.parse(sdf.format(map2.get("lut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("lut"),lut_mongo, "验证redis lut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_012() {
		Logger.start(true,"同步mongo-验证指令ProductStockChange,修改商品库存和价格");
		try{
			
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
            //创建商品同步指令
			createProduct_sync(productId);
			
			Logger.comment("productId:"+productId);
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
//			//修改 
			catalogs.setInum(1);
			int count=catalogdWapper.updateByPrimaryKey(catalogs);
			//ProductManagerCallServiceV2.updateProductStockNum(sellerId, productId, catalogs.getScatalogid(), 1);
			
			Logger.comment("CatalogId:"+catalogs.getScatalogid());
			bean.setActionType("ProductStockChange");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setCatalogId(catalogs.getScatalogid());
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			 //验证stock
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "1", "验证stock返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
		    
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				Logger.comment("######################验证mprice cid="+str_catalogId+"######################");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
              
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_012_1() {
		Logger.start(true,"同步mongo-验证指令ProductStockChange,修改商品库存和价格(神器-渠道规格库存)，渠道商品未售完");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(22.1446);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();		
			
            //创建商品同步质量
			createProduct_sync(productId);
			
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			Logger.comment("productId:"+productId);
			
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			//修改 
			catalogs.setInum(1);
			int count=catalogdWapper.updateByPrimaryKey(catalogs);
			//ProductManagerCallServiceV2.updateProductStockNum(sellerId, productId, catalogs.getScatalogid(), 1);
			
			Logger.comment("CatalogId:"+catalogs.getScatalogid());
			bean.setActionType("ProductStockChange");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setCatalogId(catalogs.getScatalogid());
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			 //验证stock
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "1", "验证stock返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
		    
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addAgentProductBean.getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
				//神器市场价 新增 20200325
				DecimalFormat df = new DecimalFormat("#.00");
				Logger.verifyEquals(Double.parseDouble(df.format(addAgentProductBean.getCatalogList().get(0).getMarketAmount())),act.getDouble("marketamt"), "验证第"+i+"条传入的神器市场价marketamt与mongo数据库是否一致");
			}
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
            
            check_godMainProduct_issellout(productId);   
            
        	//查询es
			ESsearchBean esbean=new ESsearchBean();
			ESGodsearchCall godCall=new ESGodsearchCall();
			//查询es渠道
			esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			//验证渠道商品
			EsGodProduct godProduct=godCall.getEsProduct();
			Logger.verifyEquals(false,godProduct.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_012_2() {
		Logger.start(true,"同步mongo-验证指令ProductStockChange,修改商品库存和价格(神器-代理规格库存)，渠道商品未售完");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);		
			
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			Logger.comment("productId:"+productId);
			
			//YmtCatalogs catalogs=catalogdWapper.selectBySproductId(agentProductId);
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			//修改 
			catalogs.setInum(1);
			int count=catalogdWapper.updateByPrimaryKey(catalogs);

			Logger.comment("CatalogId:"+catalogs.getScatalogid());
			bean.setActionType("ProductStockChange");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setCatalogId(catalogs.getScatalogid());
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Thread.sleep(15000);
			 //验证stock
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "1", "验证stock返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
		    
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addAgentProductBean.getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");

            check_godMainProduct_issellout(productId,agentProductId);
            
        	//查询es
			ESsearchBean esbean=new ESsearchBean();
			ESGodsearchCall godCall=new ESGodsearchCall();
			//查询es渠道
			esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			//验证渠道商品
			EsGodProduct godProduct=godCall.getEsProduct();
			Logger.verifyEquals(false,godProduct.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_012_3() {
		Logger.start(true,"同步mongo-验证指令ProductStockChange,修改商品库存和价格(神器-代理规格库存)-渠道商品售完");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);		
			
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			Logger.comment("productId:"+productId);
			
			//YmtCatalogs catalogs=catalogdWapper.selectBySproductId(agentProductId);
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			//修改 
			catalogs.setInum(0);
			int count1=catalogdWapper.updateByPrimaryKey(catalogs);

			Logger.comment("CatalogId1:"+catalogs.getScatalogid());
			bean.setActionType("ProductStockChange");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setCatalogId(catalogs.getScatalogid());
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Thread.sleep(15000);
			 //验证stock
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "0", "验证stock返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
		    
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addAgentProductBean.getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");

            check_godMainProduct_issellout(productId,agentProductId);
            
        	//查询es
			ESsearchBean esbean=new ESsearchBean();
			ESGodsearchCall godCall=new ESGodsearchCall();
			//查询es渠道
			esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			//验证渠道商品
			EsGodProduct godProduct=godCall.getEsProduct();
			Logger.verifyEquals(true,godProduct.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_012_4_111111111111() {
		Logger.start(true,"同步mongo-验证指令ProductStockChange,修改商品库存和价格(神器-代理规格库存)-渠道商品售完");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);		
			
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			Logger.comment("productId:"+productId);
			
			//YmtCatalogs catalogs=catalogdWapper.selectBySproductId(agentProductId);
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			//修改 
			catalogs.setFquoteprice(new BigDecimal(1400));
			catalogs.setInum(0);
			int count1=catalogdWapper.updateByPrimaryKey(catalogs);

			Logger.comment("CatalogId1:"+catalogs.getScatalogid());
			bean.setActionType("ProductStockChange");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setCatalogId(catalogs.getScatalogid());
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Thread.sleep(15000);
			 //验证stock
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "0", "验证stock返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
		    
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addAgentProductBean.getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
			}
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");

            check_godMainProduct_issellout(productId,agentProductId);
            
        	//查询es
			ESsearchBean esbean=new ESsearchBean();
			ESGodsearchCall godCall=new ESGodsearchCall();
			//查询es渠道
			esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			//验证渠道商品
			EsGodProduct godProduct=godCall.getEsProduct();
			Logger.verifyEquals(true,godProduct.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_013() {
		Logger.start(true,"同步mongo-验证指令UpdateSensitiveWord,更新商品敏感词");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			ModifySellerProductRequest modifySellerProductRequest=ProductManagerCallServiceV2.getModifySellerProductRequestFromAddProductBean(productId, addpro);
			modifySellerProductRequest.getProduct().setProductName("测试商品名称SB");//关键子是SB
			ModifySellerProductCall modifySellerProductCall=new ModifySellerProductCall();
			modifySellerProductCall.setData(modifySellerProductRequest);
			modifySellerProductCall.callService();
			
			new UpdateProductSensitiveWordCall().call(productId, sellerId, 1, "SB");//propertyType（1- 商品名称，2- 商品文描文字部分，3- 规格名称，4-套装名称， 5-买家须知，6-买手介绍）
			
			//修改库存stock
			bean.setActionType("UpdateSensitiveWord");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
	        //验证库存stock
		    Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
		    Logger.verifyEquals("测试商品名称**",p1.get("title").toString(), "验证mongo返回的商品名称");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_014() {
		Logger.start(true,"同步mongo-验证指令SetOffTop,设置取消推荐置顶商品,与 Ymt_ProductsInLive（商品关联直播表） 有关，此功能已经不存在");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			Logger.comment("####createlive.getId()######:"+createlive.getId());
			Logger.comment("####productId######:"+productId);
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			Logger.comment("查询商品规格");
			YmtCatalogsIWapper CIWapper = new YmtCatalogsIWapper();
			List<String> cids = CIWapper.selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			Logger.comment("创建秒杀活动");
			CreateLiveActivityBean createliveactivityBean = LiveRoomCallService.initCreateLiveActivityBean(createlive.getId(), cids.get(0), 5d, 6, starttime);
			LiveRoomCallService.CreateLiveActivity(createliveactivityBean);	
			
			modifyliveactivityBean=LiveRoomCallService.initModifyLiveActivityBean(createliveactivityBean);
			//修改结束时间
			modifyliveactivityBean.getLiveActivity().setEndTime(String.valueOf(new Date(now.getTime() + 201 * 60 * 1000).getTime()));
			//修改价格和库存
			modifyliveactivityCall.setData(modifyliveactivityBean);
			modifyliveactivityCall.callService();
			LiveRoomWapper liveroomWapper=new LiveRoomWapper();
			Map mapliveroom=liveroomWapper.selectLiveproductByIdAndPid(createlive.getId(), productId).get(0);
			Logger.comment("liveProductId:"+Integer.parseInt(mapliveroom.get("LiveProductId").toString()));
			int count=liveroomWapper.updateLiveProductStatusById(Integer.parseInt(mapliveroom.get("LiveProductId").toString()), 0, 1, 0);
			
			//修改库存stock
			bean.setActionType("SetOffTop");
			bean.setActivityId(modifyliveactivityBean.getLiveActivity().getLiveActivityId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();	 
			//直播商品更新-istop,status
//			//验证库存stock
//		    Map<String,Object> p1= liveProductWapper.getByProductId(productId);
//		    Logger.verifyEquals("0",p1.get("istop").toString(), "验证mongo返回的置顶字段istop");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_015() {
		Logger.start(true,"同步mongo-验证指令SetOnTop,设置推荐置顶商品,与 Ymt_ProductsInLive（商品关联直播表） 有关，此功能已经不存在");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			Logger.comment("查询商品规格");
			YmtCatalogsIWapper CIWapper = new YmtCatalogsIWapper();
			List<String> cids = CIWapper.selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			Logger.comment("创建秒杀活动");
			CreateLiveActivityBean createliveactivityBean = LiveRoomCallService.initCreateLiveActivityBean(createlive.getId(), cids.get(0), 5d, 6, starttime);
			LiveRoomCallService.CreateLiveActivity(createliveactivityBean);	
			
			modifyliveactivityBean=LiveRoomCallService.initModifyLiveActivityBean(createliveactivityBean);
			//修改结束时间
			modifyliveactivityBean.getLiveActivity().setEndTime(String.valueOf(new Date(now.getTime() + 201 * 60 * 1000).getTime()));
			//修改价格和库存
			modifyliveactivityCall.setData(modifyliveactivityBean);
			modifyliveactivityCall.callService();
			LiveRoomWapper liveroomWapper=new LiveRoomWapper();
			Map mapliveroom=liveroomWapper.selectLiveproductByIdAndPid(createlive.getId(), productId).get(0);
			Logger.comment("liveProductId:"+Integer.parseInt(mapliveroom.get("LiveProductId").toString()));
			int count=liveroomWapper.updateLiveProductStatusById(Integer.parseInt(mapliveroom.get("LiveProductId").toString()), 1, 1, 0);
			
			//修改库存stock
			bean.setActionType("SetOnTop");
			bean.setActivityId(modifyliveactivityBean.getLiveActivity().getLiveActivityId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();	        
			//验证库存stock
		    Map<String,Object> p1= liveProductWapper.getByProductId(productId);
		    Logger.verifyEquals("1",p1.get("istop").toString(), "验证mongo返回的置顶字段istop");
		    
		    
		    
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_016() {
		Logger.start(true,"同步mongo-验证指令ModifyPutawayProductInfo,修改上架商品信息(批量)");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ProductManagerCallServiceV2.batchSetProductOnSale(productIds, sellerId);
			//修改库存stock
			Thread.sleep(10000);
			bean.setActionType("ModifyPutawayProductInfo");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    
		    Date dt = new Date();   
		    SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		    
		    Logger.comment("newstart1:"+YMTDateUtil.getFromDTSDate(p.get("newstart").toString(),""));
		    Logger.comment("newstart2:"+YMTDateUtil.parseYMDHMSDate(formatDate.format(dt)));
		    Logger.verifyEquals(true, YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getFromDTSDate(p.get("newstart").toString(),""))
		    		.before(YMTDateUtil.parseYMDHMSDate(formatDate.format(dt))), "验证newstart");
		    
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_017() {
		//修改商品模板的频率过高，请稍后重试
		Logger.start(true,"同步mongo-验证指令ModifyDescTemplate,编辑商品描述模板--(研发黑五前修改模版5分钟跑一次，先暂时停止跑)");
		try{
			SellerProductCallService.deleteTemplate(sellerId);
			SaveProductTemplateBean saveProductTemplateBean=new SaveProductTemplateBean();
			saveProductTemplateBean.setDescription("测试模板");
			saveProductTemplateBean.setPicUrls(Arrays.asList("http://pic1.ymatou.com/G01/shangou/M00/3E/27/rBBlD1tpVJCAHMkLAAH4S4MXnxE909_375_667_n_w_o.jpg"));
			//Integer productTemplateId = TestDataManager.getRandomIntNum(10);
			//saveProductTemplateBean.setProductTemplateId(productTemplateId);
			saveProductTemplateBean.setSellerId(sellerId);
			saveProductTemplateBean.setTemplateName("Test_00" + TestDataManager.getRandomIntNum(5));
			saveProductTemplateBean.setTemplateType(2);
			
			SaveProductTemplateCall saveProductTemplateCall=new SaveProductTemplateCall();
			saveProductTemplateCall.setData(saveProductTemplateBean);
			saveProductTemplateCall.callService();
			
			int templateId=Integer.parseInt(new JSONObject(new JSONObject(saveProductTemplateCall.getReturnData()).get("Data").toString()).get("ProductTemplateId").toString());
			//添加商品
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().getDescModel().setBuyerNoticeId(templateId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			//修改模版
			String description="更改测试模板描述_"+ TestDataManager.getRandomIntNum(5);
			String templateName="更改测试模板_"+ TestDataManager.getRandomIntNum(5);
			String picurls="http://pic1.ymatou.com/G01/shangou/M00/3E/27/rBBlD1tpVJCAHMkLAAH4S4MXnxE909_375_667_n_w_o11.jpg";
			saveProductTemplateBean.setProductTemplateId(templateId);
			saveProductTemplateBean.setSellerId(sellerId);
			saveProductTemplateBean.setTemplateName("Test_00" + TestDataManager.getRandomIntNum(5));
			saveProductTemplateBean.setPicUrls(Lists.newArrayList(picurls));
			saveProductTemplateBean.setDescription(description);
			saveProductTemplateBean.setTemplateType(2);

		    saveProductTemplateCall=new SaveProductTemplateCall();
			saveProductTemplateCall.setData(saveProductTemplateBean);
			saveProductTemplateCall.callService();
			//修改库存stock
			//Thread.sleep(10000);
			bean.setActionType("ModifyDescTemplate");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
	        //验证
		    Map<String,Object> p= productDescExtraWapper.getByProductId(productId);
		    
		    Logger.verifyEquals(description, p.get("notice").toString(), "验证mongo 字段notice");
		    Logger.verifyEquals(picurls, new JSONArray(new JSONObject(p).get("notipics").toString()).get(0), "验证mongo 字段picurls");
		    
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_019() {
		Logger.start(true,"同步mongo-验证指令ModifyPutawayProductInfo,修改上架商品信息(批量)");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			ProductManagerCallServiceV2.batchSetProductOnSale(productIds, sellerId);
			
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			//修改 
			ProductManagerCallServiceV2.updateProductStockNum(sellerId, productId, catalogs.getScatalogid(), 2);
			
			
			bean.setActionType("ModifyPutawayProductInfo");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "2", "验证stock返回的库存");
		    
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_020() {
		Logger.start(true,"同步mongo-验证指令ModifyReadyPutawayProductInfo,修改商品待上架信息(批量)");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			//同步商品
			this.createProduct_sync(productId);
			
			List<String> productIds=Lists.newArrayList();
			productIds.add(productId);
			
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			//修改 
			ProductManagerCallServiceV2.updateProductStockNum(sellerId, productId, catalogs.getScatalogid(), 2);
			
			ProductManagerCallServiceV2.batchSetProductOnSale(productIds, sellerId);
	
			bean.setActionType("ModifyReadyPutawayProductInfo");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(p.get("stock").toString(), "2", "验证stock返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
		    
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_021() {
		Logger.start(true,"同步mongo-验证指令ActivityStockChange,交易更新商品活动库存");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			Logger.comment("查询商品规格");
			YmtCatalogsIWapper CIWapper = new YmtCatalogsIWapper();
			List<String> cids = CIWapper.selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			Logger.comment("创建秒杀活动");
			CreateLiveActivityBean createliveactivityBean = LiveRoomCallService.initCreateLiveActivityBean(createlive.getId(), cids.get(0), 5d, 6, starttime);
			LiveRoomCallService.CreateLiveActivity(createliveactivityBean);	
			
			modifyliveactivityBean=LiveRoomCallService.initModifyLiveActivityBean(createliveactivityBean);
			//修改结束时间
			modifyliveactivityBean.getLiveActivity().setEndTime(String.valueOf(new Date(now.getTime() + 201 * 60 * 1000).getTime()));

			modifyliveactivityCall.setData(modifyliveactivityBean);
			modifyliveactivityCall.callService();
			
			//修改
			int iActivityID=modifyliveactivityBean.getLiveActivity().getLiveActivityId();
			int productInActivityId=modifyliveactivityBean.getLiveActivity().getActivityProducts().get(0).getActivityProductId();
			int transactionId=TestDataManager.getRandomIntNum(9);
			int stockNum=TestDataManager.getRandomIntNum(1);

			Map map=productActStockWapper.selectBy(MapUtil.hashMap("sproductid",productId,"iactivityid",iActivityID));
			int count=productActStockWapper.updateiStockNumByProductActivityStockId(map.get("sProductActivityStockID").toString(),stockNum);
			Logger.comment("stockNum######:"+stockNum);
	       
			//修改库存stock
			bean.setActionType("ActivityStockChange");
			bean.setActivityId(productInActivityId);
			bean.setProductId(productId);
			bean.setTransactionId(transactionId);
			bean.setCatalogId(map.get("sCatalogID").toString());// 规格Id，目前用于交易（包括活动商品）更新库存
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= productActivityStockWapper.getByProdId(productId);
			Logger.verifyEquals(new JSONArray(p.get("catalogs").toString()).getJSONObject(0).getString("stock")
					, Integer.toString(stockNum), "验证mongo返回的库存");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyNotNull(ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");

//			Logger.verifyEquals(true,(long)ob.get("aut")>sdf.parse(map.get("dUpdateTime").toString()).getTime(), "验证aut活动商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
		    long aut_mongo=sdf.parse(sdf.format(map2.get("aut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("aut"),aut_mongo, "验证redis aut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_022() {
		Logger.start(true,"同步mongo-验证指令CatalogStockChange,交易更新商品规格库存");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);//sellerId
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			
			int transactionId=TestDataManager.getRandomIntNum(9);
			int stockNum=TestDataManager.getRandomIntNum(1);
			catalogs.setInum(stockNum);
			int count=catalogdWapper.updateByPrimaryKey(catalogs);
			
			//ProductManagerCallServiceV2.updateProductStockNum(sellerId, productId, catalogs.getScatalogid(), stockNum);

			Logger.comment("stockNum######:"+stockNum);
	       
			//修改库存stock
			bean.setActionType("CatalogStockChange");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(transactionId);
			bean.setCatalogId(catalogs.getScatalogid());// 规格Id，目前用于交易（包括活动商品）更新库存
			
			call.setData(bean);
			call.callService();
			Thread.sleep(10000);
	        //验证库存stock
		    Map<String,Object> p= new CatalogsWapper().getByCatalogId(catalogs.getScatalogid());
			Logger.verifyEquals(Integer.parseInt(p.get("stock").toString())
					, stockNum, "验证mongo返回的库存");
	
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");

			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_023() {
		Logger.start(true,"同步mongo-验证指令ModifyBrandAndCategory,修改商品分类品牌");
		try{
			Logger.comment("创建商品");
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Thread.sleep(5000);
			YmtProducts product=ymtproductsWapper.selectProductByProductId(productId);
//			product.setIbrandid(100);
//			product.setIcategoryid(1003);
			product.setIbrandid(10063);
			product.setIcategoryid(1004);
			int count=ymtproductsWapper.updateByPrimaryKey(product);
			
			int transactionId=TestDataManager.getRandomIntNum(9);
	       
			//修改库存stock
			bean.setActionType("ModifyBrandAndCategory");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(transactionId);
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
	        //验证库存stock
		    Map<String,Object> p= new ProductsWapper().getByProductId(productId);
			Logger.verifyEquals(p.get("brand").toString()
					, "三叶草", "验证mongo返回的品牌");
			Logger.verifyEquals(p.get("scatid").toString()
					, product.getIcategoryid().toString(), "验证mongo返回的分类");
		    Logger.verifyEquals(p.get("tcatname").toString()
							, "按键手机", "验证mongo返回的三级分类名称");
		    Logger.verifyEquals(p.get("scatname").toString()
							, "按键手机", "验证mongo返回的二级分类名称");
			Logger.verifyEquals(p.get("mcatname").toString()
							, "手机通讯", "验证mongo返回的一级分类名称");
				
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_024() {
		Logger.start(true,"同步mongo-验证指令SetPspStatus,设置psp状态");
		try{

			int sellerId=Integer.valueOf(EnvSetup.getData("productpriceSellerId"));
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			IntergratedProductMapper ipm = SqlMapperFactory
                    .getIntergratedProductMapper();
            ipm.insertProductInfo(productId,sellerId);
            
			int result=new YmtProductsIWapper().updatePspStatus(productId, 3);
			System.out.println("#########result:"+result);
			SetPspStatusBean setpspstatusBean = new SetPspStatusBean();
			SetPspStatusCall setpspstatusCall = new SetPspStatusCall();
			
			setpspstatusBean.setIsPassViolate(true);
			setpspstatusBean.setIsRemovePsp(false);
			setpspstatusBean.setProductId(productId);
			setpspstatusBean.setSellerId(sellerId);
			setpspstatusCall.setData(setpspstatusBean);
			setpspstatusCall.callService();	
			Thread.sleep(5000);
			int transactionId=TestDataManager.getRandomIntNum(9);
			//修改
			bean.setActionType("SetPspStatus");//Ymt_ProductPspInfo表字段 PspStatus=4 CheckStatus=1，帐号要是全球优选（1：待优化 2：待加入优选 3：优选待审，4优选商品）
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(transactionId);
			
			call.setData(bean);
			call.callService();
			Thread.sleep(2000);
	        //验证
		    Map<String,Object> p= new ProductsWapper().getByProductId(productId);
			Logger.verifyEquals("true",p.get("ispsp").toString()
					, "验证mongo返回的ispsp");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_025() {
		Logger.start(true,"同步mongo-验证指令SyncActivityProduct,同步活动商品(20201202排查-排除活动审核出错)");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);	
			});
			
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			//同步商品
			this.createProduct_sync(productId);
			//获取规格ID
			List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			//去掉规格列表的第一个参数
			//String catalog0 = catalogs.remove(0);
			//创建一个活动  得到活动id
			Integer activityId = ProductManagerCallServiceV2.createIsolationActivityInProcess();
			
			//报名活动  获得商品在活动中的id
			List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, 100,"10");
			
			//审核通过
			ProductManagerCallServiceV2.approveProductInActivity(productId,aids.get(0),true);
			
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String productName="修改报名活动名称指令测试_"+startTime;
			new YmtActivityWapper().updateSaleSideName(activityId,productName);
			
			YmtProductsInActivity  productsInActivity=productInActivityWapper.selectAllByiActivityId(activityId).get(0);
			Thread.sleep(5000);
			bean.setActionType("SyncActivityProduct");
			bean.setActivityId(productsInActivity.getIproductinactivityid());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			YmtActivityTemplateWapper ymtActivityTempWapper=new YmtActivityTemplateWapper();
			
			YmtActivity ymtActivity=ymtActivityWapper.getRecordByActivityId(activityId);
			YmtActivityTemplate temp=ymtActivityTempWapper.selectActivityTemplateById(ymtActivity.getIactivitytemplateid());
			// 验证mongo
		    Map<String,Object> p= activityProductsWapper.getByProdId(productId);
			Logger.verifyEquals(p.get("aname").toString(), productName, "验证mongo 表 activityProducts 返回的活动名称");
			Logger.verifyEquals(p.get("alevel").toString(), temp.getActivityLevel().toString(),"验证mongo 表 alevel ");
			
			YmtProducts product=productMapper.selectProductByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyNotNull(ob.get("aut"), "验证aut活动商品更新时间不为空");
			
//			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
//			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
//			
			Logger.verifyEquals(true,(long)ob.get("aut")>productsInActivity.getDaddtime().getTime(), "验证aut活动商品更新时间");	
			
			Map<String,Object> map7 = productTimeStampWapper.getByProductId(productId);	
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map7.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map7.get("sut"))).getTime();
		    long aut_mongo=sdf.parse(sdf.format(map7.get("aut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("aut"),aut_mongo, "验证redis aut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_026() {
		Logger.start(true,"同步mongo-验证指令SyncActivityProduct,如果是预售商品，缴纳保证金则同步");
		try{
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);//1:普通 2：预售
          
            for(int i=0;i<activityStockBean.getFBXCatalogLockList().size();i++){
	            activityStockBean.getFBXCatalogLockList().get(i).setEarnest(10);//定金（预售活动必填）
	            activityStockBean.getFBXCatalogLockList().get(i).setEarnestDedution(15);//定金立减（预售活动必填）
	            activityStockBean.getFBXCatalogLockList().get(i).setAction(0);//是否删除 -1 删除，0 正常，缴了保证金 1预售,未缴保证金
            }
            ProdStockCallService.AuditProductActivityStock(activityStockBean);
            
			String productId=activityStockBean.getProductID();
//			//修改Ymt_ProductActivityStock 表的 Action=0 缴了保证金
//			ymtProductActivityStockWapper.updateiActionByActivityIdAndProductId(0, productId,activityStockBean.getActivityID());

			
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String productName="修改报名活动名称指令测试_"+startTime;
			new YmtActivityWapper().updateSaleSideName(activityStockBean.getActivityID(),productName);
//			
			YmtProductsInActivity  productsInActivity=productInActivityWapper.selectAllByiActivityId(activityStockBean.getActivityID()).get(0);
			
			Logger.comment("##############productsInActivity.getIproductinactivityid():"+activityStockBean.getProductActivityId());
			bean.setActionType("SyncActivityProduct"); 
			bean.setActivityId(productsInActivity.getIproductinactivityid());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			
			YmtActivityTemplateWapper ymtActivityTempWapper=new YmtActivityTemplateWapper();
//			
			YmtActivity ymtActivity=ymtActivityWapper.getRecordByActivityId(activityStockBean.getActivityID());
			YmtActivityTemplate temp=ymtActivityTempWapper.selectActivityTemplateById(ymtActivity.getIactivitytemplateid());
			// 验证mongo
		    Map<String,Object> p= activityProductsWapper.getByProdId(productId);
			Logger.verifyEquals(p.get("aname").toString(), productName, "验证mongo 表 activityProducts 返回的活动名称");
			Logger.verifyEquals(p.get("alevel").toString(), temp.getActivityLevel().toString(),"验证mongo 表 alevel ");
			
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(0).toString()).get("atype"), 2,"验证mongo表规格上的atype ");
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(1).toString()).get("atype"), 2,"验证mongo表规格上的atype ");
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(0).toString()).get("earnest"), 10,"验证mongo表规格上的earnest定金 ");
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(1).toString()).get("earnest"), 10,"验证mongo表规格上的earnest 定金");
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(0).toString()).get("ededution"), 15,"验证mongo表规格上的ededution 定金立减金额");
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(1).toString()).get("ededution"), 15,"验证mongo表规格上的ededution 定金立减金额");
			
			Logger.verifyEquals(p.get("earnest"), 10.0,"验证mongo表最外层earnest ");
			Logger.verifyEquals(p.get("ededution"), 15.0,"验证mongo表最外层ededution ");
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyNotNull(ob.get("aut"), "验证aut活动商品更新时间不为空");
			
			
			Map<String,Object> map7 = productTimeStampWapper.getByProductId(productId);	
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map7.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map7.get("sut"))).getTime();
		    long aut_mongo=sdf.parse(sdf.format(map7.get("aut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("aut"),aut_mongo, "验证redis aut规格更新时间与mongo一致");
				
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}


	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_027() {
		Logger.start(true,"同步mongo-验证指令SyncActivityProduct,如果是预售商品，缴纳保证金则同步，两个规格上的预售价不一样");
		try{
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);//1:普通 2：预售
          
            activityStockBean.getFBXCatalogLockList().get(0).setEarnest(10);//定金（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(0).setEarnestDedution(15);//定金立减（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(0).setAction(1);//是否删除 -1 删除，0 正常，缴了保证金 1预售,未缴保证金
            
            activityStockBean.getFBXCatalogLockList().get(1).setEarnest(20);//定金（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(1).setEarnestDedution(25);//定金立减（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(1).setAction(1);//是否删除 -1 删除，0 正常，缴了保证金 1预售,未缴保证金
            
            ProdStockCallService.AuditProductActivityStock(activityStockBean);
            
			String productId=activityStockBean.getProductID();
			//修改Ymt_ProductActivityStock 表的 Action=0 缴了保证金
			ymtProductActivityStockWapper.updateiActionByActivityIdAndProductId(0, productId,activityStockBean.getActivityID());

			
			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String productName="修改报名活动名称指令测试_"+startTime;
			new YmtActivityWapper().updateSaleSideName(activityStockBean.getActivityID(),productName);
			
			YmtProductsInActivity  productsInActivity=productInActivityWapper.selectAllByiActivityId(activityStockBean.getActivityID()).get(0);
			
			Logger.comment("##############productsInActivity.getIproductinactivityid():"+activityStockBean.getProductActivityId());
			bean.setActionType("SyncActivityProduct"); 
			bean.setActivityId(productsInActivity.getIproductinactivityid());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			YmtActivityTemplateWapper ymtActivityTempWapper=new YmtActivityTemplateWapper();
			
			YmtActivity ymtActivity=ymtActivityWapper.getRecordByActivityId(activityStockBean.getActivityID());
			YmtActivityTemplate temp=ymtActivityTempWapper.selectActivityTemplateById(ymtActivity.getIactivitytemplateid());
			List<YmtProductActivityStock> ymtproductActivityStock=ymtProductActivityStockWapper.selectByProductId(productId);
			// 验证mongo
		    Map<String,Object> p= activityProductsWapper.getByProdId(productId);
			Logger.verifyEquals(p.get("aname").toString(), productName, "验证mongo 表 activityProducts 返回的活动名称");
			Logger.verifyEquals(p.get("alevel").toString(), temp.getActivityLevel().toString(),"验证mongo 表 alevel ");
			JSONArray cObjArray =new JSONArray(p.get("catalogs").toString());
			for(int i=0;i<ymtproductActivityStock.size();i++)
			{
				for(int j=0;j<cObjArray.length();j++)
				{
					if(ymtproductActivityStock.get(i).getScatalogid().equals(new JSONObject(cObjArray.get(j).toString()).get("cid")))
					{
						Logger.verifyEquals(new BigDecimal(new JSONObject(cObjArray.get(i).toString()).get("earnest").toString()).stripTrailingZeros(),
								new BigDecimal(ymtproductActivityStock.get(i).getEarnest()).stripTrailingZeros(),"验证mongo表第"+i+"个规格上的earnest");
					}
				}
			}
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(0).toString()).get("atype"), 2,"验证mongo表第1个规格上的atype");
			Logger.verifyEquals(new JSONObject(new JSONArray(p.get("catalogs").toString()).get(1).toString()).get("atype"), 2,"验证mongo表第1个规格上的atype");
			
			Logger.verifyEquals(p.get("earnest"), 10.0,"验证mongo表最外层earnest ");
			Logger.verifyEquals(p.get("ededution"), 15.0,"验证mongo表最外层ededution ");
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyNotNull(ob.get("aut"), "验证aut活动商品更新时间不为空");
			
			
			Map<String,Object> map7 = productTimeStampWapper.getByProductId(productId);	
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map7.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map7.get("sut"))).getTime();
		    long aut_mongo=sdf.parse(sdf.format(map7.get("aut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("aut"),aut_mongo, "验证redis aut规格更新时间与mongo一致");
					
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
		
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_028() {
		Logger.start(true,"同步mongo-验证指令SyncActivityProduct,如果是预售商品，未缴纳保证金则不同步");
		try{
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);//1:普通 2：预售
          
            activityStockBean.getFBXCatalogLockList().get(0).setEarnest(10);//定金（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(0).setEarnestDedution(15);//定金立减（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(0).setAction(1);//是否删除 -1 删除，0 正常，缴了保证金 ，1：预售,缴保证金
            
            activityStockBean.getFBXCatalogLockList().get(1).setEarnest(20);//定金（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(1).setEarnestDedution(25);//定金立减（预售活动必填）
            activityStockBean.getFBXCatalogLockList().get(1).setAction(1);//是否删除 -1 删除，0 正常，缴了保证金 ，1：预售,缴保证金
            
            ProdStockCallService.AuditProductActivityStock(activityStockBean);
			String productId=activityStockBean.getProductID();
			//修改Ymt_ProductActivityStock 表的 Action=0 缴了保证金
		//	ymtProductActivityStockWapper.updateiActionByActivityIdAndProductId(0, productId,activityStockBean.getActivityID());

			String startTime = YMTDateUtil.getBeforeOrNextDayStr(YMTDateUtil.getBeforeOrNextDay(0), 0);
			String productName="修改报名活动名称指令测试_"+startTime;
			new YmtActivityWapper().updateSaleSideName(activityStockBean.getActivityID(),productName);
			
			YmtProductsInActivity  productsInActivity=productInActivityWapper.selectAllByiActivityId(activityStockBean.getActivityID()).get(0);
			Logger.comment("##############productsInActivity.getIproductinactivityid():"+activityStockBean.getProductActivityId());
			bean.setActionType("SyncActivityProduct"); 
			bean.setActivityId(productsInActivity.getIproductinactivityid());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService(); 
			
			Thread.sleep(5000);
			
			JSONObject obj=new  JSONObject(call.getReturnData());
			Logger.verifyEquals(true,obj.get("errorMessage").toString().contains("getActivityProductCatalogs 为空"), "验证errorMessage");
			Logger.verifyEquals("-3",obj.get("errorCode").toString(), "验证errorCode");
			Logger.verifyEquals("false",obj.get("success").toString(), "验证success");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_028_1() {
		Logger.start(true,"同步mongo-验证指令SyncActivityProduct,同步活动商品,重点验证若市场价market=\"\"则设置为\"0\" (20201202排查-排除活动审核有问题)");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			// 设置商品库存,规格库存
			Integer catalogNum = 1000;
			addpro.getProduct().getCatalogList().forEach(catalog -> {
				catalog.setStock(catalogNum);
			});
			
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			//同步商品
			this.createProduct_sync(productId);
			//获取规格ID
			List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			//去掉规格列表的第一个参数
			//String catalog0 = catalogs.remove(0);
			//创建一个活动  得到活动id
			Integer activityId = ProductManagerCallServiceV2.createIsolationActivityInProcess();
			
			//报名活动  获得商品在活动中的id
			List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, 100,"10");
			
			//审核通过
			ProductManagerCallServiceV2.approveProductInActivity(productId,aids.get(0),true);
			
			YmtProductsInActivity  productsInActivity=productInActivityWapper.selectAllByiActivityId(activityId).get(0);
			productsInActivity.setSmarketprice("");//修改市场价为空
			productInActivityWapper.updateByPrimaryKey(productsInActivity);
			
			Thread.sleep(5000);
			bean.setActionType("SyncActivityProduct");
			bean.setActivityId(productsInActivity.getIproductinactivityid());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			YmtActivityTemplateWapper ymtActivityTempWapper=new YmtActivityTemplateWapper();
			
			YmtActivity ymtActivity=ymtActivityWapper.getRecordByActivityId(activityId);
			YmtActivityTemplate temp=ymtActivityTempWapper.selectActivityTemplateById(ymtActivity.getIactivitytemplateid());
			// 验证mongo
		    Map<String,Object> p= activityProductsWapper.getByProdId(productId);
			Logger.verifyEquals(p.get("market").toString(), "0","验证mongo 表 market ");//市场价
			
		
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({P1.class}) 
	@TestCase
	public void Tc_Mongocrud_029() {
		Logger.start(true,"同步mongo-验证指令CreateGroupon,创建商品拼团");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
//			addpro.getProduct().getCatalogList().get(0).setPrice(100);
//			addpro.getProduct().getCatalogList().get(1).setPrice(100);
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			//创建预售 平团价格  fMarketPrice 码头市场价格，max（规格码头市场价*90%，规格码头市场价-10元）   等出来的指要小于 fQuotePrice
			Double price0=addpro.getProduct().getCatalogList().get(0).getPrice();
			Double price1=addpro.getProduct().getCatalogList().get(1).getPrice();
			Double fprice0=price0 * 0.9d>price0 -10?price0 * 0.9d:price0 -10;
			Double fprice1=price1 * 0.9d>price1 -10?price1 * 0.9d:price1 -10;	
			SaveGrouponBean saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,fprice0>fprice1?fprice1-1:fprice0-1);
			
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			
			List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(saveGrouponBean.getProductId(), null, 0);
			
			bean.setActionType("CreateGroupon"); 
			bean.setActivityId(gp.get(0).getGrouponProductId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			//验证mongDB表 GrouponProducts
			Map<String,Object>  map=mongoDB_grouponProductsWapper.getByProductId(productId);
			
			List<GrouponCatalogs> catalogs = YmtProductsIWapper.selectGrouponCatalogs(null, gp.get(0).getVersion().intValue());
			JSONArray jsonArray=new JSONArray(map.get("catalogs").toString());
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
			Logger.verifyEquals(Long.parseLong(map.get("ver").toString()),gp.get(0).getVersion(), "验证mongo ver字段与sql数据库Version字段一致");
			Logger.verifyEquals(Integer.parseInt(map.get("goId").toString()),gp.get(0).getGrouponProductId(), "验证mongo goId字段与sql数据库GrouponProductId字段一致");
			//Logger.verifyEquals(sdf.format(map.get("start")),sdf.format(gp.get(0).getStartTime()), "验证mongo start字段与sql数据库StartTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("end")),sdf.format(gp.get(0).getEndTime()), "验证mongo end字段与sql数据库EndTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("updatetime")),sdf.format(gp.get(0).getUpdateTime()), "验证mongo updatetime字段与sql数据库UpdateTime字段一致");
			Logger.verifyEquals(new JSONArray(map.get("catalogs").toString()).length(),catalogs.size(), "验证mongo 数据与与sql数据库 一致");

			for(int i=0;i<catalogs.size();i++)
			{
				for(int j=0;j<jsonArray.length();j++)
				{
					if(catalogs.get(i).getCatalogId().equals(new JSONObject(jsonArray.get(j).toString()).get("cid")))
					{
						Logger.verifyEquals(catalogs.get(i).getCatalogId(),new JSONObject(jsonArray.get(j).toString()).get("cid"), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						Logger.verifyEquals(catalogs.get(i).getGrouponPrice().stripTrailingZeros().toString(),
								new BigDecimal(new JSONObject(jsonArray.get(j).toString()).get("price").toString()).stripTrailingZeros().toString(), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						 break;
					}
				}
			}
			//验证redis与mongDB
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);	
		    long gut_mongo=sdf.parse(sdf.format(map2.get("gut"))).getTime();
			//Logger.verifyEquals((long)ob.get("gut"),gut_mongo, "验证redis gut拼团创建时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class}) 
	@TestCase
	public void Tc_Mongocrud_029_5() {
		Logger.start(true,"同步mongo-验证指令CreateGroupon,创建商品拼团");
		try{
//			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
//			addpro.getProduct().getCatalogList().remove(0);
////			addpro.getProduct().getCatalogList().get(0).setPrice(100);
////			addpro.getProduct().getCatalogList().get(1).setPrice(100);
//			//获取商品ID
//			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productId="p4168878";
			//创建预售 平团价格  fMarketPrice 码头市场价格，max（规格码头市场价*90%，规格码头市场价-10元）   等出来的指要小于 fQuotePrice
//			Double price0=addpro.getProduct().getCatalogList().get(0).getPrice();
//			Double price1=addpro.getProduct().getCatalogList().get(1).getPrice();
//			Double fprice0=price0 * 0.9d>price0 -10?price0 * 0.9d:price0 -10;
//			Double fprice1=price1 * 0.9d>price1 -10?price1 * 0.9d:price1 -10;	
			//SaveGrouponBean saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,fprice0>fprice1?fprice1-1:fprice0-1);
			SaveGrouponBean saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,13d);
			
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			
			List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(saveGrouponBean.getProductId(), null, 0);
			
			bean.setActionType("CreateGroupon"); 
			bean.setActivityId(gp.get(0).getGrouponProductId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class}) 
	@TestCase
	public void Tc_Mongocrud_029_1() {
		Logger.start(true,"同步mongo-验证指令CreateGroupon,创建商品拼团-越洋店铺(神器)");
		try{
			
			Logger.comment("####创建拼团######");
			Integer mchId = GodmchManageCallService.CreateSellerMch();
		    AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId,"AutoTest",false);
		    addAgentProductBean.getCatalogList().remove(0);
		    String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
		    List<String> catalogList =new ArrayList<String>();
		    ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(mchId,productId);
		    selectProductDetails.getCatalogList().forEach(a->{
		     catalogList.add(a.getCatalogId());
		     });
		   
		    SaveGrouponReq savegrouponBean = Shop2cnGrouponCallService.initSaveGrouponReq(mchId, productId, catalogList.get(0), 100d);
		    Integer grouponProductId = Shop2cnGrouponCallService.SaveGrouponCall(savegrouponBean);
			 //查询  GrouponCatalogs
		    List<GrouponCatalogs>  gp= YmtProductsIWapper.selectGrouponCatalogs(catalogList.get(0), null);
			  
			bean.setActionType("CreateGroupon"); 
			bean.setActivityId(grouponProductId);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			//验证mongDB表 GrouponProducts
			Map<String,Object>  map=mongoDB_grouponProductsWapper.getByProductId(productId);
			
			List<GrouponCatalogs> catalogs = YmtProductsIWapper.selectGrouponCatalogs(null, gp.get(0).getVersion().intValue());
			JSONArray jsonArray=new JSONArray(map.get("catalogs").toString());
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
			Logger.verifyEquals(Long.parseLong(map.get("ver").toString()),gp.get(0).getVersion(), "验证mongo ver字段与sql数据库Version字段一致");
			Logger.verifyEquals(Integer.parseInt(map.get("goId").toString()),gp.get(0).getGrouponProductId(), "验证mongo goId字段与sql数据库GrouponProductId字段一致");
			//Logger.verifyEquals(sdf.format(map.get("start")),sdf.format(gp.get(0).getStartTime()), "验证mongo start字段与sql数据库StartTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("end")),sdf.format(gp.get(0).getEndTime()), "验证mongo end字段与sql数据库EndTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("updatetime")),sdf.format(gp.get(0).getUpdateTime()), "验证mongo updatetime字段与sql数据库UpdateTime字段一致");
			Logger.verifyEquals(new JSONArray(map.get("catalogs").toString()).length(),catalogs.size(), "验证mongo 数据与与sql数据库 一致");

			for(int i=0;i<catalogs.size();i++)
			{
				for(int j=0;j<jsonArray.length();j++)
				{
					if(catalogs.get(i).getCatalogId().equals(new JSONObject(jsonArray.get(j).toString()).get("cid")))
					{
						Logger.verifyEquals(catalogs.get(i).getCatalogId(),new JSONObject(jsonArray.get(j).toString()).get("cid"), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						Logger.verifyEquals(catalogs.get(i).getGrouponPrice().stripTrailingZeros().toString(),
								new BigDecimal(new JSONObject(jsonArray.get(j).toString()).get("price").toString()).stripTrailingZeros().toString(), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						 break;
					}
				}
			}
			//验证redis与mongDB
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);	
		    long gut_mongo=sdf.parse(sdf.format(map2.get("gut"))).getTime();
			Logger.verifyEquals((long)ob.get("gut"),gut_mongo, "验证redis gut拼团创建时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class}) 
	@TestCase
	public void Tc_Mongocrud_029_11() {
		Logger.start(true,"同步mongo-验证指令CreateGroupon,创建商品拼团-越洋店铺(神器)");
		try{
			
//			Logger.comment("####创建拼团######");
//			Integer mchId = GodmchManageCallService.CreateSellerMch();
//		    AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId,"AutoTest",false);
//		    addAgentProductBean.getCatalogList().remove(0);
//		    String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
		    String productId="p4170390";
		    Integer mchId=500924711;
		    
		    List<String> catalogList =new ArrayList<String>();
		    ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(mchId,productId);
		    selectProductDetails.getCatalogList().forEach(a->{
		     catalogList.add(a.getCatalogId());
		     });

		    SaveGrouponReq savegrouponBean = Shop2cnGrouponCallService.initSaveGrouponReq(mchId, productId, catalogList.get(0), 103d);
		    Integer grouponProductId = Shop2cnGrouponCallService.SaveGrouponCall(savegrouponBean);
			 //查询  GrouponCatalogs
		    List<GrouponCatalogs>  gp= YmtProductsIWapper.selectGrouponCatalogs(catalogList.get(0), null);
			  
			bean.setActionType("CreateGroupon"); 
			bean.setActivityId(grouponProductId);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_030() {
		Logger.start(true,"同步mongo-验证指令ModifyGrouponPrice,修改商品规格并团价");
		try{
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			//创建预售
			addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
			//创建预售 平团价格  fMarketPrice 码头市场价格，max（规格码头市场价*90%，规格码头市场价-10元）   等出来的指要小于 fQuotePrice
			Double price0=addpro.getProduct().getCatalogList().get(0).getPrice();
			Double price1=addpro.getProduct().getCatalogList().get(1).getPrice();
			Double fprice0=price0 * 0.9d>price0 -10?price0 * 0.9d:price0 -10;
			Double fprice1=price1 * 0.9d>price1 -10?price1 * 0.9d:price1 -10;	
			SaveGrouponBean saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,fprice0>fprice1?fprice1-1:fprice0-1);
			
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);

			Double update_grouponPrice=price0-2;
			List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(saveGrouponBean.getProductId(), null, 0);
			saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,update_grouponPrice);
			saveGrouponBean.setOperateType(1);//1:编辑 0:创建
			saveGrouponBean.setGrouponProductId(gp.get(0).getGrouponProductId());
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);

			bean.setActionType("ModifyGrouponPrice"); 
			bean.setActivityId(gp.get(0).getGrouponProductId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(3000);
			//验证mongDB表 GrouponProducts
			Thread.sleep(2000);
			List<GrouponProducts> gp2 = YmtProductsIWapper.selectGrouponProducts(saveGrouponBean.getProductId(), null, 0);
			Map<String,Object>  map=mongoDB_grouponProductsWapper.getByVersion(gp2.get(0).getVersion());
			
			List<GrouponCatalogs> catalogs = YmtProductsIWapper.selectGrouponCatalogs(null, gp2.get(0).getVersion().intValue());
			JSONArray jsonArray=new JSONArray(map.get("catalogs").toString());
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
			Logger.verifyEquals(Long.parseLong(map.get("ver").toString()),gp2.get(0).getVersion(), "验证mongo ver字段与sql数据库Version字段一致");
			Logger.verifyEquals(Integer.parseInt(map.get("goId").toString()),gp2.get(0).getGrouponProductId(), "验证mongo goId字段与sql数据库GrouponProductId字段一致");
			//Logger.verifyEquals(sdf.format(map.get("start")),sdf.format(gp2.get(0).getStartTime()), "验证mongo start字段与sql数据库StartTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("end")),sdf.format(gp2.get(0).getEndTime()), "验证mongo end字段与sql数据库EndTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("updatetime")),sdf.format(gp2.get(0).getUpdateTime()), "验证mongo updatetime字段与sql数据库UpdateTime字段一致");
			Logger.verifyEquals(new JSONArray(map.get("catalogs").toString()).length(),catalogs.size(), "验证mongo 数据与与sql数据库 一致");

			for(int i=0;i<catalogs.size();i++)
			{
				for(int j=0;j<jsonArray.length();j++)
				{
					if(catalogs.get(i).getCatalogId().equals(new JSONObject(jsonArray.get(j).toString()).get("cid")))
					{
						Logger.verifyEquals(catalogs.get(i).getCatalogId(),new JSONObject(jsonArray.get(j).toString()).get("cid"), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						Logger.verifyEquals(new BigDecimal(update_grouponPrice).stripTrailingZeros().toString(),
								new BigDecimal(new JSONObject(jsonArray.get(j).toString()).get("price").toString()).stripTrailingZeros().toString(), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						 break;
					}
				}
			}
			//验证redis与mongDB
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);	
		    long gut_mongo=sdf.parse(sdf.format(map2.get("gut"))).getTime();
			Logger.verifyEquals((long)ob.get("gut"),gut_mongo, "验证redis gut拼团创建时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	//修改神器平台时间，开始、结束
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_030_1() {
		Logger.start(true,"同步mongo-验证指令ModifyGrouponPrice,修改商品规格并团价-越洋店铺(神器)");
		try{
//			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
//			//获取商品ID
//			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
//			//创建预售
//			addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
//			//创建预售 平团价格  fMarketPrice 码头市场价格，max（规格码头市场价*90%，规格码头市场价-10元）   等出来的指要小于 fQuotePrice
//			Double price0=addpro.getProduct().getCatalogList().get(0).getPrice();
//			Double price1=addpro.getProduct().getCatalogList().get(1).getPrice();
//			Double fprice0=price0 * 0.9d>price0 -10?price0 * 0.9d:price0 -10;
//			Double fprice1=price1 * 0.9d>price1 -10?price1 * 0.9d:price1 -10;	
//			SaveGrouponBean saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,fprice0>fprice1?fprice1-1:fprice0-1);
//			
//			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
//
//			Double update_grouponPrice=price0-2;
//			List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(saveGrouponBean.getProductId(), null, 0);
//			saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,update_grouponPrice);
//			saveGrouponBean.setOperateType(1);//1:编辑 0:创建
//			saveGrouponBean.setGrouponProductId(gp.get(0).getGrouponProductId());
//			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			
			Logger.comment("####创建拼团开始######");
			Integer mchId = GodmchManageCallService.CreateSellerMch();
		    AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId,"AutoTest",false);
		    String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
		    List<String> catalogList =new ArrayList<String>();
		    ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(mchId,productId);
		    selectProductDetails.getCatalogList().forEach(a->{
		     catalogList.add(a.getCatalogId());
		     });
		    
		    Double price0=addAgentProductBean.getCatalogList().get(0).getDirectPrice();
		    Double update_grouponPrice=price0-2;
		    SaveGrouponReq savegrouponBean = Shop2cnGrouponCallService.initSaveGrouponReq(mchId, productId, catalogList.get(0), update_grouponPrice);
		    Integer grouponProductId = Shop2cnGrouponCallService.SaveGrouponCall(savegrouponBean);
		    Logger.comment("####创建拼团结束######");
			 //查询  GrouponCatalogs
			List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(savegrouponBean.getProductId(), null, 0);
			String timeFormat="yyyy-MM-dd HH:mm:ss";
			String start=LocalDateTime.now().plusDays(-2).format(DateTimeFormatter.ofPattern(timeFormat));
			String end=LocalDateTime.now().plusDays(2).format(DateTimeFormatter.ofPattern(timeFormat));
			YmtProductsIWapper.updateStatusGrouponProducts(productId,gp.get(0).getVersion(),null,start,end);//修改价格，开始结束时间

			bean.setActionType("ModifyGrouponPrice"); 
			bean.setActivityId(gp.get(0).getGrouponProductId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(3000);
			//验证mongDB表 GrouponProducts
			Thread.sleep(2000);
			
			List<GrouponProducts> gp2 = YmtProductsIWapper.selectGrouponProducts(savegrouponBean.getProductId(), null, 0);
			Map<String,Object>  map=mongoDB_grouponProductsWapper.getByVersion(gp2.get(0).getVersion());
			
			List<GrouponCatalogs> catalogs = YmtProductsIWapper.selectGrouponCatalogs(null, gp2.get(0).getVersion().intValue());
			JSONArray jsonArray=new JSONArray(map.get("catalogs").toString());
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
			Logger.verifyEquals(Long.parseLong(map.get("ver").toString()),gp2.get(0).getVersion(), "验证mongo ver字段与sql数据库Version字段一致");
			Logger.verifyEquals(Integer.parseInt(map.get("goId").toString()),gp2.get(0).getGrouponProductId(), "验证mongo goId字段与sql数据库GrouponProductId字段一致");
			//Logger.verifyEquals(sdf.format(map.get("start")),sdf.format(gp2.get(0).getStartTime()), "验证mongo start字段与sql数据库StartTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("end")),sdf.format(gp2.get(0).getEndTime()), "验证mongo end字段与sql数据库EndTime字段一致");
			//Logger.verifyEquals(sdf.format(map.get("updatetime")),sdf.format(gp2.get(0).getUpdateTime()), "验证mongo updatetime字段与sql数据库UpdateTime字段一致");
			Logger.verifyEquals(new JSONArray(map.get("catalogs").toString()).length(),catalogs.size(), "验证mongo 数据与与sql数据库 一致");

			for(int i=0;i<catalogs.size();i++)
			{
				for(int j=0;j<jsonArray.length();j++)
				{
					if(catalogs.get(i).getCatalogId().equals(new JSONObject(jsonArray.get(j).toString()).get("cid")))
					{
						Logger.verifyEquals(catalogs.get(i).getCatalogId(),new JSONObject(jsonArray.get(j).toString()).get("cid"), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						Logger.verifyEquals(new BigDecimal(update_grouponPrice).stripTrailingZeros().toString(),
								new BigDecimal(new JSONObject(jsonArray.get(j).toString()).get("price").toString()).stripTrailingZeros().toString(), 
								"验证mongo cid字段与数据库GrouponProducts表 catalogs字段一致");
						 break;
					}
				}
			}
			//验证redis与mongDB
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);	
		    long gut_mongo=sdf.parse(sdf.format(map2.get("gut"))).getTime();
			Logger.verifyEquals((long)ob.get("gut"),gut_mongo, "验证redis gut拼团创建时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_031() {
		Logger.start(true,"同步mongo-验证指令StopGroupon,停止拼团");
		try{
			
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId3);
			//获取商品ID
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			
			//创建预售 平团价格  fMarketPrice 码头市场价格，max（规格码头市场价*90%，规格码头市场价-10元）   等出来的指要小于 fQuotePrice
			Double price0=addpro.getProduct().getCatalogList().get(0).getPrice();
			Double price1=addpro.getProduct().getCatalogList().get(1).getPrice();
			Double fprice0=price0 * 0.9d>price0 -10?price0 * 0.9d:price0 -10;
			Double fprice1=price1 * 0.9d>price1 -10?price1 * 0.9d:price1 -10;	
			SaveGrouponBean saveGrouponBean=ProductManagerCallServiceV3.initSaveGrouponBean(sellerId3,productId,fprice0>fprice1?fprice1-1:fprice0-1);
			
			ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
			List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(saveGrouponBean.getProductId(), null, 0);
			YmtProductsIWapper.updateStatusGrouponProducts(productId,gp.get(0).getVersion(),1,null,null);
			
			bean.setActionType("StopGroupon"); 
			bean.setActivityId(gp.get(0).getGrouponProductId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongDB表 GrouponProducts
			Map<String,Object>   mongoDB_product=mongoDB_productsWapper.getByProductId(productId);
			List<String>  mongoDB_Catalogs=mongoDB_productsWapper.getByPid(productId);

			Logger.verifyEquals("0",mongoDB_product.get("goversion").toString(), "验证mongo goversion字段停止拼团为0");
			for(int i=0;i<mongoDB_Catalogs.size();i++)
			{
				Logger.verifyEquals("null",new JSONObject(mongoDB_Catalogs.get(i)).getString("goprice"), 
						"验证mongo catalogs表 goprice字段停止拼团是为null");
			}
			//验证redis与mongDB
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);	
		    long gut_mongo=sdf.parse(sdf.format(map2.get("gut"))).getTime();
			Logger.verifyEquals((long)ob.get("gut"),gut_mongo, "验证redis gut拼团创建时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_031_1() {
		Logger.start(true,"同步mongo-验证指令StopGroupon,停止拼团-越洋店铺(神器)");
		try{
			Logger.comment("####创建拼团开始######");
			Integer mchId = GodmchManageCallService.CreateSellerMch();
		    AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId,"AutoTest",false);
		    String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
		    List<String> catalogList =new ArrayList<String>();
		    ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(mchId,productId);
		    selectProductDetails.getCatalogList().forEach(a->{
		     catalogList.add(a.getCatalogId());
		     });
		    
		    Double price0=addAgentProductBean.getCatalogList().get(0).getDirectPrice();
		    Double update_grouponPrice=price0-2;
		    SaveGrouponReq savegrouponBean = Shop2cnGrouponCallService.initSaveGrouponReq(mchId, productId, catalogList.get(0), update_grouponPrice);
		    Integer grouponProductId = Shop2cnGrouponCallService.SaveGrouponCall(savegrouponBean);
		    Logger.comment("####创建拼团结束######");
			 //查询  GrouponCatalogs
		    List<GrouponCatalogs>  gp= YmtProductsIWapper.selectGrouponCatalogs(catalogList.get(0), null);
		    YmtProductsIWapper.updateStatusGrouponProducts(productId,gp.get(0).getVersion(),1,null,null);
			
			bean.setActionType("StopGroupon"); 
			bean.setActivityId(gp.get(0).getGrouponProductId());
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongDB表 GrouponProducts
			Map<String,Object>   mongoDB_product=mongoDB_productsWapper.getByProductId(productId);
			List<String>  mongoDB_Catalogs=mongoDB_productsWapper.getByPid(productId);

			Logger.verifyEquals("0",mongoDB_product.get("goversion").toString(), "验证mongo goversion字段停止拼团为0");
			for(int i=0;i<mongoDB_Catalogs.size();i++)
			{
				Logger.verifyEquals("null",new JSONObject(mongoDB_Catalogs.get(i)).getString("goprice"), 
						"验证mongo catalogs表 goprice字段停止拼团是为null");
			}
			//验证redis与mongDB
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);	
		    long gut_mongo=sdf.parse(sdf.format(map2.get("gut"))).getTime();
			Logger.verifyEquals((long)ob.get("gut"),gut_mongo, "验证redis gut拼团创建时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_032_11() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,国内渠道,发布国内商品(20201202排查-暂时不在此站点维护)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(domestic_sellerId,domestic_sellerName,true);
			addAgentProductBean.setCurrency("CNY");
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(addAgentProductBean.getUserId(),Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_1_1() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-信息不完善(info 信息完善进度，-2-价格问题，-1-信息未完善，0，信息完整)");
		try{
			AddAgentProductBean addAgentProductBean2 = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			List<String> picList = new ArrayList<>();
	        picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l.jpg");
	        List<CatalogDto> catalogDtos = new ArrayList<>();
	        CatalogDto catalogDto = new CatalogDto();
	        catalogDtos.add(catalogDto);
	        
			AddAgentProductBean addAgentProductBean=new AddAgentProductBean();
			addAgentProductBean.setTitle("测试");
			addAgentProductBean.setPics(picList);
			addAgentProductBean.setSaleType(2);
			addAgentProductBean.setUserId(sellerId1);
			addAgentProductBean.setCatalogList(catalogDtos);
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
//			
//			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.debug("p:"+p);
			Logger.verifyIsNull(p, "信息不完善，商品表不同步数据");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_1() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-普通代理");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(agentProductId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            check_godMainProduct_issellout(productId,agentProductId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_2() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-Vip渠道");
		try{
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致(渠道商Id)");     
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_3() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-Vip代理");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(2,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(agentProductId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            check_godMainProduct_issellout(productId,agentProductId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_4() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,同步代购规格重量，商品运费模板");
		int  templateId =0;
		try{
			//添加模版
			CreateFreightTemplateBean createBean=GodfreightmgrService.initCreateFreightTemplate(sellerId1,1,1);
			createBean.setPolicyModel(1);
			 templateId =Integer.parseInt(GodfreightmgrService.CreateFreightTemplate(createBean));
			//商品添加模版
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.setFreightTemplateId(templateId);
			
			addAgentProductBean.getCatalogList().remove(1);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			Logger.verifyEquals(Integer.parseInt(Json.parseJsonObj(Json.parseJsonArray(p.get("templates").toString()).get(0)).get("Tlid").toString()), 
					templateId, "验证返回templates集合汇总的tlid");
			Logger.verifyEquals(Integer.parseInt(Json.parseJsonObj(Json.parseJsonArray(p.get("templates").toString()).get(0)).get("Cls").toString()), 
					addAgentProductBean.getCatalogStatus(), "验证返回templates集合汇总的cls");
			
			//mong0_Catalogs
			BasicDBObject search = new BasicDBObject();
			search.append("sku", addAgentProductBean.getCatalogList().get(0).getSku());
			search.append("spid", productId);
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
            Logger.verifyEquals(new BigDecimal(addAgentProductBean.getCatalogList().get(0).getWeight()).stripTrailingZeros().toPlainString()
            		,new BigDecimal(clist.get(0).get("wt").toString()).stripTrailingZeros().toPlainString(),"验证规格上的wt");

            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            check_godMainProduct_issellout(productId);
            //删除商品
            AddAgentProductCallService.DeleteProduct(productId,sellerId1);
            //删除模版
            GodfreightmgrService.DeleteTemplateInfo(sellerId1,templateId);
            
		}catch(Exception e){
			Logger.fail(e);
		}finally
		{
            freight_templateWapper templateWapper = new freight_templateWapper();
        	templateWapper.updateStatusByKey(templateId);
        	Logger.comment("已执行");
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_5() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,重点验证国内货币");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.setCurrency("CNY");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			AgentProductPo agentProductPo= YmtProductsIWapper.selectAgentProductByProductId(productId);
		    Logger.verifyEquals(agentProductPo.getCurrency(),p.get("currency").toString(), "验证currency与mongo数据库是否一致");
            
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_6() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道,重点验证神器商品同步本店铺中不可见字段");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.setInvisible(true);//addAgentProductBean 神器商品同步店铺中不可见字段
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals("true",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_7() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道,重点验证神器商品同步本店铺中可见字段");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.setInvisible(false);//addAgentProductBean 神器商品同步店铺中可见字段
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals("false",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_8() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-代理,重点验证神器商品同步本店铺中不可见字段");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.setInvisible(true);//addAgentProductBean 神器商品同步店铺中不可见字段
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals("true",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_9() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-代理,重点验证神器商品同步本店铺中可见字段");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.setInvisible(false);//addAgentProductBean 神器商品同步店铺中不可见字段
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals("false",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_032_10() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-验证越洋店铺小视频(20201202排查-神器商品同步暂时不在此站点维护)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			//初始化一个带视频的商品bean
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			   
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            check_godVideo(productId,addAgentProductBean);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_12() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-自提,不快递配送-自提");
		try{
			//开启运营
		    GodfreightmgrService.setCollectionGoodsByAdminCall(sellerId1, true);
		    //开启自提
            GodfreightmgrService.setCollectionGoodsBySellerCall(sellerId1, true);
            
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			
			addAgentProductBean.setExpressDelivery(false);//不快递配送
			addAgentProductBean.setCollectionGoods(true);//自提
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_13() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-不自提,快递配送,最小起购数量为5");
		//请至少选择一种配送方式
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			
			addAgentProductBean.setExpressDelivery(true);//不快递配送
			addAgentProductBean.setCollectionGoods(false);//不自提
			addAgentProductBean.setMinOrderNum(5);//最小起购数量为5
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_14() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-商品条码");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);

			//新增 20200522
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
            addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));
              
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            //checkverify_godProduct(p,productId,addAgentProductBean);
           // check_godMainProduct_issellout(productId);
            
            Logger.debug("验证规格");
            List<YmtCatalogsI> ymtCatalogsIList = CIWapper.selectCatalogsByProductId(productId);
            addAgentProductBean.getCatalogList().forEach(c->{
                
            for (YmtCatalogsI ymtCatalogsI:ymtCatalogsIList) {
            	 if (c.getSku().equals(ymtCatalogsI.getsSKU()) && new BigDecimal(c.getDirectPrice()).stripTrailingZeros().equals(ymtCatalogsI.getfQuotePrice().stripTrailingZeros()) ){
            		 
                     try {
                    	Logger.comment("##########sku:"+c.getSku()+"###########");
                    	BasicDBObject search = new BasicDBObject();
         				search.append("sku", c.getSku());
         				search.append("spid", productId);
         				search.append("price", c.getDirectPrice());
         				
         				// 验证规格 商品条码
         				List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
                        Logger.verifyEquals(ymtCatalogsI.getBarcode(),clist.get(0).get("bc").toString(),"验证bc 渠道原始规格Id");

					} catch (Exception e) {
						e.printStackTrace();
					}  
                 }
               }
            }); 
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//业务测试反馈这个商家铺了大量商品导致总线阻塞
	public void Tc_Mongocrud_032_15() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-商品参数json新增2020617");
		try{
			sellerId1=501217421;
			agentUserId1=501217422;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productParam="{'啊啊':'哈哈'}";
			addAgentProductBean.setProductParam(productParam);
			
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            
            Logger.verifyEquals("啊啊",new JSONArray(ext.get("props").toString()).getJSONObject(0).getString("key"), "验证productDescExtra表中的props.key字段");
            Logger.verifyEquals("哈哈",new JSONArray(ext.get("props").toString()).getJSONObject(0).getString("value"), "验证productDescExtra表中的props.value字段");
            
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_16_1111111111() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道(20200703上级售价,不同步)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            //Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_17_11111111111111() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-普通代理(20200703上级售价)");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(agentProductId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            check_godMainProduct_issellout(productId,agentProductId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_032_18() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-商品副标题、销售区域、自提点地址列表");
		try{
			//设置提货地址开始
			//Integer mchId_channl = GodmchManageCallService.CreateSellerMch();
			Integer mchId_channl =sellerId1;
            //开启运营
            GodfreightmgrService.setCollectionGoodsByAdminCall(mchId_channl, true);
            CreateCollectionGoodsAddressBean createcollectiongoodsaddressBean = GodfreightmgrService.initCreateCollectionGoodsAddressBean(mchId_channl);
            int addressId1 = GodfreightmgrService.createcollectiongoodsaddressCall(createcollectiongoodsaddressBean);
            createcollectiongoodsaddressBean = GodfreightmgrService.initCreateCollectionGoodsAddressBean(mchId_channl);
            int addressId2 = GodfreightmgrService.createcollectiongoodsaddressCall(createcollectiongoodsaddressBean);
           //设置提货地址结束
            
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addAgentProductBean.setSubTitle("商品副标题_"+TestDataManager.getRandomIntNum(5));
			addAgentProductBean.setSaleArea(3);
			addAgentProductBean.setNoReasonReturn(true); 
			addAgentProductBean.setCollectionGoodsAddress(Lists.newArrayList(addressId1,addressId2));
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			//String[] array=p.get("coladdr").toString().split(",");
			//String coladdrs=List.class.getp.get("coladdr").toString();
            Logger.verifyEquals(addAgentProductBean.getSubTitle(),p.get("stitle").toString(), "验证传入的商品类型stitle与mongo数据库是否一致");
            Logger.verifyEquals(addAgentProductBean.getSaleArea(),Integer.parseInt(p.get("sarea").toString()), "验证传入的商品类型sarea与mongo数据库是否一致");
            Logger.verifyEquals(addAgentProductBean.getCollectionGoodsAddress().toString().replace(" ", ""),p.get("coladdr").toString().replace(" ", ""), "验证传入的商品类型coladdr与mongo数据库是否一致");
            Logger.verifyEquals(addAgentProductBean.getNoReasonReturn(),Boolean.parseBoolean(p.get("noreason").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
//            Logger.comment("校验updateTime");
//            Date newDate=new Date();
//            long timeNow=newDate.getTime();
//            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
//            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
//            long subTime=timeOld-timeNow;
//            System.out.println("###subTime####"+(timeOld-timeNow));
//            Logger.verifyEquals(true, subTime<10000, "验证mongo数据库 product 中的updatetime 与当前时间小于10秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_1_1() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,多个规格，修改其中一个规格-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);

			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			modifyAgentProductBean.setThirdCategoryId(1004);
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_1() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-普通代理");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,importAgentProductBean);
			modifyAgentProductBean.setTitle(new_title);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(agentProductId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            Logger.verifyEquals(new_title,p.get("title").toString(), "验证mongo表字段title");
            
            check_godMainProduct_issellout(productId,agentProductId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_2() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-Vip渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setTitle(new_title);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致(渠道商Id)");     
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            Logger.verifyEquals(new_title,p.get("title").toString(), "验证mongo表字段title");
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_3() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-Vip代理");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,importAgentProductBean);
			modifyAgentProductBean.setTitle(new_title);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(5000);
            
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(2,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(agentProductId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            Logger.verifyEquals(new_title,p.get("title").toString(), "验证mongo表字段title");
            check_godMainProduct_issellout(productId,agentProductId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_4() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,同步代购规格重量，商品运费模板");
		int templateId1=0;
		int templateId2=0;
		try{
			//添加模版
			CreateFreightTemplateBean createBean=GodfreightmgrService.initCreateFreightTemplate(sellerId1,1,1);
			 templateId1 =Integer.parseInt(GodfreightmgrService.CreateFreightTemplate(createBean));
			Logger.comment("############templateId1:  "+templateId1);
			
			CreateFreightTemplateBean createBean2=GodfreightmgrService.initCreateFreightTemplate(sellerId1,1,1);
			 templateId2 =Integer.parseInt(GodfreightmgrService.CreateFreightTemplate(createBean2));
			Logger.comment("############templateId2:  "+templateId2);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.setFreightTemplateId(templateId1);
			
			addAgentProductBean.getCatalogList().remove(1);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setCurrency(createBean2.getCurrency());
			modifyAgentProductBean.setFreightTemplateId(templateId2);//修改模版
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setWeight(5);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			Logger.verifyEquals(Integer.parseInt(Json.parseJsonObj(Json.parseJsonArray(p.get("templates").toString()).get(0)).get("Tlid").toString()), 
					templateId2, "验证返回templates集合汇总的tlid");
			Logger.verifyEquals(Integer.parseInt(Json.parseJsonObj(Json.parseJsonArray(p.get("templates").toString()).get(0)).get("Cls").toString()), 
					addAgentProductBean.getCatalogStatus(), "验证返回templates集合汇总的cls");
			
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
			//mongo_Catalogs
			BasicDBObject search = new BasicDBObject();
			search.append("sku", addAgentProductBean.getCatalogList().get(0).getSku());
			search.append("spid", productId);
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
            Logger.verifyEquals("5"
            		,new BigDecimal(clist.get(0).get("wt").toString()).stripTrailingZeros().toPlainString(),"验证规格上的wt");
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
		finally
		{
            freight_templateWapper templateWapper = new freight_templateWapper();
        	templateWapper.updateStatusByKey(templateId1);
        	templateWapper.updateStatusByKey(templateId2);
		}
		
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_5() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-渠道,重点验证神器商品同步本店铺中不可见字段");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.setInvisible(true);
			
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals("true",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_6() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-渠道,重点验证神器商品同步本店铺中可见字段");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.setInvisible(false);
			
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals("false",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_7() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-代理,重点验证神器商品同步本店铺中不可见字段");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.setInvisible(true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,importAgentProductBean);
			modifyAgentProductBean.setTitle(new_title);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals("true",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_8() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-代理,重点验证神器商品同步本店铺中可见字段");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.setInvisible(false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBeanByImportant(agentProductId,importAgentProductBean);
			modifyAgentProductBean.setTitle(new_title);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals("false",p.get("invis").toString(), "验证传入的商品类型invis与mongo数据库是否一致");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_9() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-渠道-条码");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.getCatalogList().remove(0);
			//新增 20200522
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
            addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));
            
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();

			//新增 20200522
			barCodes = Arrays.asList("A456_b456_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			modifyAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);

            Logger.debug("验证规格");         
            List<YmtCatalogsI> ymtCatalogsIList = CIWapper.selectCatalogsByProductId(productId);
            addAgentProductBean.getCatalogList().forEach(c->{
            for (YmtCatalogsI ymtCatalogsI:ymtCatalogsIList) {
            	 if (c.getSku().equals(ymtCatalogsI.getsSKU()) && new BigDecimal(c.getDirectPrice()).stripTrailingZeros().equals(ymtCatalogsI.getfQuotePrice().stripTrailingZeros()) ){
                     try {
                    	Logger.comment("##########sku:"+c.getSku()+"###########");
                    	BasicDBObject search = new BasicDBObject();
         				search.append("sku", c.getSku());
         				search.append("spid", productId);
         				search.append("price", c.getDirectPrice());
         				// 验证规格 商品条码
         				List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
                        Logger.verifyEquals(ymtCatalogsI.getBarcode(),clist.get(0).get("bc").toString(),"验证bc 渠道原始规格Id");

					} catch (Exception e) {
						e.printStackTrace();
					}  
                 }
               }
            }); 
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_033_10_11111111() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-渠道(20200703上级售价,不同步)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			Logger.comment("directPrice:"+directPrice);
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_033_11_11111111() {
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改自采商品,导入代理商品-普通代理(20200703上级售价)(20201202排查-暂时不在此站点维护)");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改
			String new_title="测试修改渠道自采商品_"+TestDataManager.getRandomIntNum(5);
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setTitle(new_title);
			
			//double directPrice=modifyAgentProductBean.getCatalogList().get(0).getDirectPrice();
			//Logger.comment("directPrice:"+directPrice);
			//modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(directPrice-1);//修改其中一个规格直销价
			//20200703 修改上级售价
			modifyAgentProductBean.getCatalogList().get(0).setDirectPrice(1500);
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(agentProductId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            Logger.verifyEquals(new_title,p.get("title").toString(), "验证mongo表字段title");
            
            check_godMainProduct_issellout(productId,agentProductId);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_034() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelf,渠道商上架商品-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.setSaleType(2);//保存下架
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//上架
			AddAgentProductCallService.SetOnshelf(productId,sellerId1);
			
			
			bean.setActionType("AgentProductOnShelf"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");//上架
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            checkverify_godProduct(p,productId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_034_1() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelf,渠道商上架商品-普通代理(代理不能导入进来的商品 下架)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.setSaleType(2);//保存下架
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//上架
			AddAgentProductCallService.SetOnshelf(agentProductId,agentUserId1);
			
			
			bean.setActionType("AgentProductOnShelf"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
            Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_034_2() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelf,渠道商上架商品-Vip渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addAgentProductBean.setSaleType(2);//保存下架
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//上架
			AddAgentProductCallService.SetOnshelf(productId,vipRootUserId);
			
			bean.setActionType("AgentProductOnShelf");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致(渠道商Id)");     
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致(原始自采商品ID)");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_034_3() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelf,渠道商上架商品-Vip代理");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			addAgentProductBean.setSaleType(2);//下架
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//上架
			AddAgentProductCallService.SetOnshelf(agentProductId,vipAgentUserId1);
			
			bean.setActionType("AgentProductOnShelf"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(2,Integer.parseInt(p.get("agtype").toString()), "验证agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("puid").toString()), "验证puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(productId,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            checkverify_godProduct( p,agentProductId,addAgentProductBean);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_035() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelfSingle,商品上架，查找子商品依次发送上架指令-渠道(没有子商品,这里的子商品是指代理商的商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.setSaleType(2);//保存下架
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//上架
			AddAgentProductCallService.SetOnshelf(productId,sellerId1);
			
			bean.setActionType("AgentProductOnShelfSingle"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(10000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");//上架
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            checkverify_godProduct(p,productId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_035_1() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelfSingle,商品上架，查找子商品依次发送上架指令-普通代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.setSaleType(2);//保存下架
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//上架
			AddAgentProductCallService.SetOnshelf(productId,sellerId1);
			
			bean.setActionType("AgentProductOnShelfSingle"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(10000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证渠道agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证渠道status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证渠道puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 渠道ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(productId,p2.get("ppid")==null?0:p2.get("ppid").toString(), "验证 代理商品ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p2.get("puid").toString()), "验证代理商品puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(1,Integer.parseInt(p2.get("agtype").toString()), "验证代理商品agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p2.get("status").toString()), "验证代理商品status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
           // checkverify_godProduct( p,agentProductId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_035_2() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelfSingle,商品上架，查找子商品依次发送上架指令-vip代理(无子商品,这里的子商品是指代理商的商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addAgentProductBean.setSaleType(2);//保存下架
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//上架
			AddAgentProductCallService.SetOnshelf(productId,vipRootUserId);
			
			bean.setActionType("AgentProductOnShelfSingle");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(15000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致(渠道商Id)");     
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致(原始自采商品ID)");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_035_3() {
		Logger.start(true,"同步mongo-验证指令AgentProductOnShelfSingle,商品上架，查找子商品依次发送上架指令-vip代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			addAgentProductBean.setSaleType(2);//下架
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//上架
			AddAgentProductCallService.SetOnshelf(agentProductId,vipAgentUserId1);
			
			bean.setActionType("AgentProductOnShelfSingle"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(10000);
            
    		//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证渠道agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证渠道status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证渠道puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 渠道ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(productId,p2.get("ppid")==null?0:p2.get("ppid").toString(), "验证 代理商品ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p2.get("puid").toString()), "验证代理商品puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(2,Integer.parseInt(p2.get("agtype").toString()), "验证代理商品agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p2.get("status").toString()), "验证代理商品status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_036() {
		Logger.start(true,"同步mongo-验证指令AgentProductOffShelf,商品上架，查找子商品依次发送上架指令-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//下架
			AddAgentProductCallService.SetOffshelf(productId,sellerId1);
			
			bean.setActionType("AgentProductOffShelf"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(2,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");//下架
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            checkverify_godProduct(p,productId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_036_2() {
		Logger.start(true,"同步mongo-验证指令AgentProductOffShelf,渠道商上架商品-Vip渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//上架
			AddAgentProductCallService.SetOffshelf(productId,vipRootUserId);
			
			bean.setActionType("AgentProductOffShelf");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(2,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");//下架
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致(渠道商Id)");     
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致(原始自采商品ID)");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_037() {
		Logger.start(true,"同步mongo-验证指令AgentProductOffShelfSingle,商品上架，查找子商品依次发送上架指令-渠道(没有子商品,这里的子商品是指代理商的商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//上架
			AddAgentProductCallService.SetOffshelf(productId,sellerId1);
			
			bean.setActionType("AgentProductOffShelfSingle"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(2,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");//上架
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");

            //checkverify_godProduct(p,productId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_037_1() {
		Logger.start(true,"同步mongo-验证指令AgentProductOffShelfSingle,商品上架，查找子商品依次发送上架指令-普通代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//上架
			AddAgentProductCallService.SetOffshelf(productId,sellerId1);
			
			bean.setActionType("AgentProductOffShelfSingle"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();

			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证渠道agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(2,Integer.parseInt(p.get("status").toString()), "验证渠道status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证渠道puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 渠道ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(productId,p2.get("ppid")==null?0:p2.get("ppid").toString(), "验证 代理商品ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p2.get("puid").toString()), "验证代理商品puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(1,Integer.parseInt(p2.get("agtype").toString()), "验证代理商品agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(2,Integer.parseInt(p2.get("status").toString()), "验证代理商品status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            
           // checkverify_godProduct( p,agentProductId,addAgentProductBean);

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_037_2() {
		Logger.start(true,"同步mongo-验证指令AgentProductOffShelfSingle,商品上架，查找子商品依次发送上架指令-vip代理(无子商品,这里的子商品是指代理商的商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addAgentProductBean.setSaleType(2);//保存下架
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//上架
			AddAgentProductCallService.SetOffshelf(productId,vipRootUserId);
			
			bean.setActionType("AgentProductOffShelfSingle");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(2,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致(渠道商Id)");     
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致(原始自采商品ID)");
            
            //checkverify_godProduct(p,productId,addAgentProductBean);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_037_3() {
		Logger.start(true,"同步mongo-验证指令AgentProductOffShelfSingle,商品上架，查找子商品依次发送上架指令-vip代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			addAgentProductBean.setSaleType(2);//下架
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//上架
			AddAgentProductCallService.SetOffshelf(agentProductId,vipAgentUserId1);
			
			bean.setActionType("AgentProductOffShelfSingle"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            
           // checkverify_godProduct( p,agentProductId,addAgentProductBean);
    		//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证ptype与mongo数据库是否(商品类型；0-普通商品， 1- 直播微店商品，2-全球优选商品，3-微信代购商品)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证渠道agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证渠道status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证渠道puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(0,p.get("ppid")==null?0:p.get("ppid").toString(), "验证 渠道ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p.get("ruid").toString()), "验证ruid与mongo数据库是否一致(渠道商Id)");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证rpid与mongo数据库是否一致(原始自采商品ID)");
            
            Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(productId,p2.get("ppid")==null?0:p2.get("ppid").toString(), "验证 代理商品ppid与mongo数据库是否一致(上级代理商品Id)");
            Logger.verifyEquals(vipRootUserId,Integer.parseInt(p2.get("puid").toString()), "验证代理商品puid与mongo数据库是否一致(上级代理Id)");
            Logger.verifyEquals(2,Integer.parseInt(p2.get("agtype").toString()), "验证代理商品agtype与mongo数据库是否一致(代理类型，0-自采，1-普通代理，2-VIP代理)");
            Logger.verifyEquals(1,Integer.parseInt(p2.get("status").toString()), "验证代理商品status与mongo数据库是否一致(商品状态，1-上架，2-下架)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_038() {
		Logger.start(true,"同步mongo-验证指令DeleteAgentProduct,上级商品删除，所有下级商品也需要删除,代理商移除商品-渠道(没有子商品,这里的子商品是指代理商的商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			AddAgentProductCallService.DeleteProduct(productId, sellerId1);
			
			bean.setActionType("DeleteAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			//验证mongo_product
			List<String> p=mongoDB_productsWapper.getByPid(productId);
			Logger.verifyEquals(0,p.size(),"验证mongo没有数据");
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL 移除字段 iaction=-2(状态，0-正常，-1-删除，-2-移除)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_038_1() {
		Logger.start(true,"同步mongo-验证指令DeleteAgentProduct,商品上架，查找子商品依次发送上架指令-普通代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			//同步代理商品
			AddAgentProduct_sync(productId);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//同步代理商品
			AddAgentProduct_sync(agentProductId);
			
			//删除
			AddAgentProductCallService.DeleteProduct(agentProductId, agentUserId1);
			
			bean.setActionType("DeleteAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(5000);
			//验证mongo_product
			List<String> p=mongoDB_productsWapper.getByPid(agentProductId);
			Logger.verifyEquals(0,p.size(),"验证mongo没有数据");
			YmtProducts product=productMapper.selectProductByProductId(agentProductId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL 移除字段 iaction=-2(状态，0-正常，-1-删除，-2-移除)");
		    
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_038_2() {
		Logger.start(true,"同步mongo-验证指令DeleteAgentProduct,商品上架，查找子商品依次发送上架指令-vip代理(无子商品,这里的子商品是指代理商的商品)");
		try{
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			AddAgentProductCallService.DeleteProduct(productId, vipRootUserId);
			
			bean.setActionType("DeleteAgentProduct");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			Thread.sleep(5000);
			//验证mongo_product
			List<String> p=mongoDB_productsWapper.getByPid(productId);
			Logger.verifyEquals(0,p.size(),"验证mongo没有数据");
			YmtProducts product=productMapper.selectProductByProductId(productId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL 移除字段 iaction=-2(状态，0-正常，-1-删除，-2-移除)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_038_3() {
		Logger.start(true,"同步mongo-验证指令DeleteAgentProduct,商品上架，查找子商品依次发送上架指令-vip代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//org.junit.Assert.fail();
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			addAgentProductBean.setSaleType(2);//下架
			//同步商品
			this.createProduct_sync(productId);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//同步商品
			this.createProduct_sync(agentProductId);
			
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//删除
			AddAgentProductCallService.DeleteProduct(agentProductId, vipAgentUserId1);
			
			bean.setActionType("DeleteAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(3000);
			//验证mongo_product
			List<String> p=mongoDB_productsWapper.getByPid(agentProductId);
			Logger.verifyEquals(0,p.size(),"验证mongo没有数据");
			YmtProducts product=productMapper.selectProductByProductId(agentProductId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL 移除字段 iaction=-2(状态，0-正常，-1-删除，-2-移除)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}

	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_039() {
		Logger.start(true,"同步mongo-验证指令SetAgentProductPriceSpot,修改商品价格，更改代理的等级导致价格不符合要求-渠道(没有子商品,这里的子商品是指代理商的商品)");
		try{
			//创建代理
			listagentTypeBean typeBean=GodmchManageCallService.InitlistgentTypeBean(sellerId1);
			listagentTypeCall typeCall=GodmchManageCallService.listgentTypeCall(typeBean);
			//org.junit.Assert.fail();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			if(addAgentProductBean.getCatalogList().get(0).getAgentPriceList().size()==0)
			{
		       List<AgentPriceDto> agentPriceDtos = new ArrayList<>();
		       AgentPriceDto priceDto=new AgentPriceDto();
		       priceDto.setAgentPrice(5);
		       priceDto.setAgentTypeId(typeCall.getAgentTypes().get(0).getAgentType());
		       addAgentProductBean.getCatalogList().get(0).setAgentPriceList(agentPriceDtos);
			}
//		        
//			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(5);//渠道商代理价
			addagentproductCall.setData(addAgentProductBean);                                
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			//获取代理类型
//			listagentTypeBean typeBean=GodmchManageCallService.InitlistgentTypeBean(sellerId1);
//			listagentTypeCall typeCall=GodmchManageCallService.listgentTypeCall(typeBean);
			List<AgentPriceDto> agentPriceList=new ArrayList();
			AgentPriceDto  priceDto=new AgentPriceDto();
			priceDto.setAgentTypeId(typeCall.getAgentTypes().get(0).getAgentType());
			priceDto.setAgentPrice(500);
			agentPriceList.add(priceDto);
			//修改代理价格	
			modifyAgentProductBean.getCatalogList().get(0).setAgentPriceList(agentPriceList);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("SetAgentProductPriceSpot"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			Logger.verifyEquals(p.get("infop").toString(), "0", "验证返回infop 为0,未改变(信息完善进度，-2-价格问题，-1-信息未完善，0，信息完整)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_039_1() {
		Logger.start(true,"同步mongo-验证指令SetAgentProductPriceSpot,修改商品价格，更改代理的等级导致价格不符合要求-普通代理(有子商品,这里的子商品是指代理商的商品)");
		try{
            //渠道商品不完善满足条件 1：ymt_AgentPrice 渠道商品的代理价少于子商品规格(Ymt_Catalogs)的直销价
			//后面为了做继承业务，渠道商品的代理价不能大于直销商品的直销价，比喻：渠道商品 直销价500，代理价格600，继承父级之后，子商品卖500，但是进货价是600，亏本了
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().get(0).setDirectPrice(500d);//渠道商代理价
			addAgentProductBean.getCatalogList().get(1).setDirectPrice(500d);//渠道商代理价
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			//同步代理商品
			AddAgentProduct_sync(productId);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.getCatalogList().get(0).setDirectPrice(200d);
			importAgentProductBean.getCatalogList().get(1).setDirectPrice(200d);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//同步代理商品
			AddAgentProduct_sync(agentProductId);
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//修改渠道商品 直销价
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(300);//代理价
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("SetAgentProductPriceSpot"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(5000);
            
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(p.get("spid").toString(), agentProductId, "验证返回spid");
			Logger.verifyEquals(p.get("infop").toString(), "-2", "验证返回infop 为-2,未完善(信息完善进度，-2-价格问题，-1-信息未完善，0，信息完整)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_039_2() {
		Logger.start(true,"同步mongo-验证指令SetAgentProductPriceSpot,商品上架，查找子商品依次发送上架指令-vip代理(无子商品,这里的子商品是指代理商的商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(5);//渠道商代理价
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//同步代理商品
			AddAgentProduct_sync(productId);
			
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			//获取代理类型
			listagentTypeBean typeBean=GodmchManageCallService.InitlistgentTypeBean(sellerId1);
			listagentTypeCall typeCall=GodmchManageCallService.listgentTypeCall(typeBean);
			List<AgentPriceDto> agentPriceList=new ArrayList();
			AgentPriceDto  priceDto=new AgentPriceDto();
			priceDto.setAgentTypeId(typeCall.getAgentTypes().get(0).getAgentType());
			priceDto.setAgentPrice(500);
			agentPriceList.add(priceDto);
			//修改代理价格	
			modifyAgentProductBean.getCatalogList().get(0).setAgentPriceList(agentPriceList);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("SetAgentProductPriceSpot");  
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			Logger.verifyEquals(p.get("infop").toString(), "0", "验证返回infop 为0,未改变(信息完善进度，-2-价格问题，-1-信息未完善，0，信息完整)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_039_3() {
		Logger.start(true,"同步mongo-验证指令SetAgentProductPriceSpot,商品上架，查找子商品依次发送上架指令-vip代理(有子商品,这里的子商品是指代理商的商品)");
		try{
			//获取代理类型
			listagentTypeBean typeBean=GodmchManageCallService.InitlistgentTypeBean(sellerId1);
			listagentTypeCall typeCall=GodmchManageCallService.listgentTypeCall(typeBean);
			List<AgentPriceDto> agentPriceList=new ArrayList();
			AgentPriceDto  priceDto=new AgentPriceDto();
			priceDto.setAgentTypeId(typeCall.getAgentTypes().get(0).getAgentType());
			priceDto.setAgentPrice(1);
			agentPriceList.add(priceDto);
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			addAgentProductBean.setSaleType(2);//下架
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改渠道商品 直销价
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(500);//代理价
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("SetAgentProductPriceSpot"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			Logger.verifyEquals(p.get("infop").toString(), "0", "验证返回infop 为0,未改变(信息完善进度，-2-价格问题，-1-信息未完善，0，信息完整)");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_040() {
		Logger.start(true,"同步mongo-验证指令DeleteAgentProduct,上级商品删除，所有下级商品也需要删除-渠道商品(没有上级商品)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			//获取商品ID
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			AddAgentProductCallService.DeleteProduct(productId, sellerId1);
			
			//batchSetProductOnSale
			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("DeleteAgentProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    
		    Logger.verifyIsNull(p,"验证mongo没有数据");
			
		    YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(productId);
			
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_040_1() {
		Logger.start(true,"同步mongo-验证指令DeleteAgentProduct,上级商品删除，所有下级商品也需要删除-渠道商品(有上级商品)(20201203神器商品暂时不在此站点维护)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			//获取商品ID
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//同步代理商品
			AddAgentProduct_sync(productId);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//同步代理商品
			AddAgentProduct_sync(agentProductId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			AddAgentProductCallService.DeleteProduct(agentProductId, agentUserId1);

			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("DeleteAgentProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
		    
		    Logger.verifyIsNull(p,"验证mongo没有数据");
			
		    YmtProducts product=productMapper.selectProductByProductId(agentProductId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(agentProductId);
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(agentProductId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			//获取当前时间&结束时间
			Map<String,Object> map2 = productTimeStampWapper.getByProductId(agentProductId);
			System.out.println("mongo cut:"+sdf.format(map2.get("cut")));
			System.out.println("mongo sut:"+sdf.format(map2.get("sut")));
			
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_041() {
		Logger.start(true,"同步mongo-验证指令RemoveAgenter,移除代理商，删除此代理及下级代理所有的商品-渠道商品(有上级商品) 渠道-代理");
		try{
			//创建渠道和代理商户
			UserCreateBean usercreateBean1=DGUserCallService.initUsercreateBean();
			int userId_channl=DGUserCallService.UserCreateCall(usercreateBean1);
			
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel(userId_channl);
			GodmchManageCallService.createmchCallForChannel(createmchbean);
			List<createmchBean> mchBeanList=GodmchManageCallService.InitcreatemchBeanForAgent(userId_channl);
			createmchBean createBean_agent=mchBeanList.get(0);
			GodmchManageCallService.createmchCallForAgent(createBean_agent);
			int userId_agent=createBean_agent.getMchId();
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,usercreateBean1.getNickname(),true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			//获取商品ID
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,createBean_agent.getNickName(),productId,userId_channl,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
            //移除商户
			removemchCall removemchcall=GodmchManageCallService.InitremovemchForAgent(userId_channl,userId_agent);

			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("RemoveAgenter");
			bean.setActivityId(userId_agent);
			bean.setProductId(String.valueOf(userId_channl));
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
			BasicDBObject search=new BasicDBObject();
			search.append("sid", userId_agent);
			List<Map> p=mongoDB_productsWapper.selectProduct(search,null);
			Logger.verifyEquals(0,p.size(),"验证mongo没有数据");
			
			YmtProducts product=productMapper.selectProductByProductId(agentProductId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL 移除字段 iaction=-2(状态，0-正常，-1-删除，-2-移除)");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_041_1() {
		Logger.start(true,"同步mongo-验证指令RemoveAgenter,移除代理商，删除此代理及下级代理所有的商品-渠道商品(有上级商品) vip渠道-vip代理-vip代理");
		try{
			//org.junit.Assert.fail();
			//创建渠道和代理商户
			UserCreateBean usercreateBean1=DGUserCallService.initUsercreateBean();
			int userId_channl=DGUserCallService.UserCreateCall(usercreateBean1);
			
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel(userId_channl);
			GodmchManageCallService.createmchCallForChannel(createmchbean);

			List<createmchBean> mchBeanList=GodmchManageCallService.InitcreatemchBeanForAgent(userId_channl);
			createmchBean createBean_agent=mchBeanList.get(0);
			GodmchManageCallService.createmchCallForAgent(createBean_agent);
			int userId_agent=createBean_agent.getMchId();
			//创建第二个代理，与渠道绑定
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,usercreateBean1.getNickname(),true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			//获取商品ID
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,createBean_agent.getNickName(),productId,userId_channl,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
            //移除商户
			removemchCall removemchcall=GodmchManageCallService.InitremovemchForAgent(userId_channl,userId_agent);

			//修改库存stock
			Thread.sleep(5000);
			bean.setActionType("RemoveAgenter");
			bean.setActivityId(userId_agent);
			bean.setProductId(String.valueOf(userId_channl));
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
	        //验证库存stock
		    
			BasicDBObject search=new BasicDBObject();
			search.append("sid", userId_agent);
			List<Map> p=mongoDB_productsWapper.selectProduct(search,null);
			Logger.verifyEquals(0,p.size(),"验证mongo没有数据");
			
			YmtProducts product=productMapper.selectProductByProductId(agentProductId);
		    Logger.verifyEquals(-2,product.getIaction(), "验证SQL 移除字段 iaction=-2(状态，0-正常，-1-删除，-2-移除)");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_042() {
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,创建自采商品,导入代理商品-渠道-外币USD");
		try{
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			createmchBean cbean = GodmchManageCallService.InitcreatemchBeanForChannel(userId);
			cbean.setCountry("USA");
			GodmchManageCallService.createmchCallForChannel(cbean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId,cbean.getNickName(),true);
			addAgentProductBean.setCurrency("USD");
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//验证币种
			 Logger.verifyEquals("USD",p.get("currency").toString(), "验证currency为USD");
			 
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(userId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            Logger.comment("校验updateTime");
            Date newDate=new Date();
            long timeNow=newDate.getTime();
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            long timeOld=sdf.parse(sdf.format(p.get("updatetime"))).getTime();
            long subTime=timeOld-timeNow;
            System.out.println("###subTime####"+(timeOld-timeNow));
            Logger.verifyEquals(true, subTime<5000, "验证mongo数据库 product 中的updatetime 与当前时间小于5秒");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_043() {
		Logger.start(true,"同步mongo-验证指令SyncAllAgentProductStockStatus-未售完");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("SyncAllAgentProductStockStatus"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(false,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_043_1() {
		Logger.start(true,"同步mongo-验证指令SyncAllAgentProductStockStatus-所有规格售完，同步售完");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();

			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			
			bean.setActionType("SyncAllAgentProductStockStatus"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(2000);
			
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(true,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(true,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_043_2() {
		Logger.start(true,"同步mongo-验证指令SyncAllAgentProductStockStatus-单规格售完，不同步售完");
		try{
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();

			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			//modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			
			bean.setActionType("SyncAllAgentProductStockStatus"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(2000);
			
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(false,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_043_3() {
		Logger.start(true,"同步mongo-验证指令SyncAllAgentProductStockStatus-代理部分规格商品-代理商品售完");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.getCatalogList().remove(0);//移除一个规格，代理渠道商品一个规格
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			//modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("SyncAllAgentProductStockStatus"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			Thread.sleep(10000);
			
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(true,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_044_1() {
		Logger.start(true,"同步mongo-验证指令CheckAndSyncAgentProductStockStatus-代理部分规格商品-代理商品售完-需要同步(发SyncAgentProductStockStatus消息,es处理)");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.getCatalogList().remove(0);//移除一个规格，代理渠道商品一个规格
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			//modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("CheckAndSyncAgentProductStockStatus"); 
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			Thread.sleep(10000);
			
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(true,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
            
            //查询es
            esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证渠道商品
			EsGodProduct product=godCall.getEsProduct();
			Logger.verifyEquals(false,product.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
			//验证代理商品
			esbean.setProductId("pid:"+agentProductId);
			godCall.setData(esbean);
			godCall.callService();
			EsGodProduct agentProduct=godCall.getEsProduct();
			Logger.verifyEquals(true,agentProduct.getissellout(), "验证es代理issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_044_2() {
		Logger.start(true,"同步mongo-验证指令CheckAndSyncAgentProductStockStatus-代理部分规格商品-代理商品售完-不需要同步(发SyncAgentProductStockStatus消息,es处理)");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importAgentProductBean.getCatalogList().remove(0);//移除一个规格，代理渠道商品一个规格
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			//modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			//modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("CheckAndSyncAgentProductStockStatus"); 
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			Thread.sleep(10000);
			
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(false,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
            
            //查询es
            esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证渠道商品
			EsGodProduct product=godCall.getEsProduct();
			Logger.verifyEquals(false,product.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
			//验证代理商品
			esbean.setProductId("pid:"+agentProductId);
			godCall.setData(esbean);
			godCall.callService();
			EsGodProduct agentProduct=godCall.getEsProduct();
			Logger.verifyEquals(false,agentProduct.getissellout(), "验证es代理issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_044_3() {
		Logger.start(true,"同步mongo-验证指令CheckAndSyncAgentProductStockStatus-代理q全部规格商品-代理商品售完-需要同步(发SyncAgentProductStockStatus消息,es处理)");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
		//	importAgentProductBean.getCatalogList().remove(0);//移除一个规格，代理渠道商品一个规格
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("CheckAndSyncAgentProductStockStatus"); 
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			Thread.sleep(10000);
			
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(true,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(true,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
            
            //查询es
            esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证渠道商品
			EsGodProduct product=godCall.getEsProduct();
			Logger.verifyEquals(true,product.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
			//验证代理商品
			esbean.setProductId("pid:"+agentProductId);
			godCall.setData(esbean);
			godCall.callService();
			EsGodProduct agentProduct=godCall.getEsProduct();
			Logger.verifyEquals(true,agentProduct.getissellout(), "验证es代理issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_044_4() {
		Logger.start(true,"同步mongo-验证指令CheckAndSyncAgentProductStockStatus-代理全部规格商品-代理商品售完-不需要同步(发SyncAgentProductStockStatus消息,es处理)");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			//importAgentProductBean.getCatalogList().remove(0);//移除一个规格，代理渠道商品一个规格
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改库存为0
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
			//modifyAgentProductBean.getCatalogList().get(0).setStock(0);
			//modifyAgentProductBean.getCatalogList().get(1).setStock(0);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("CheckAndSyncAgentProductStockStatus"); 
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			Thread.sleep(10000);
			
			//验证mongo_product
			//渠道商品
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
			//代理商品
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
            Logger.verifyEquals(false,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
            
            //查询es
            esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			//验证渠道商品
			EsGodProduct product=godCall.getEsProduct();
			Logger.verifyEquals(false,product.getissellout(), "验证es渠道issellout(true:售完  false:未售完)");
			//验证代理商品
			esbean.setProductId("pid:"+agentProductId);
			godCall.setData(esbean);
			godCall.callService();
			EsGodProduct agentProduct=godCall.getEsProduct();
			Logger.verifyEquals(false,agentProduct.getissellout(), "验证es代理issellout(true:售完  false:未售完)");

		}catch(Exception e){
			Logger.fail(e);
		}
	}
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_Mongocrud_044() {
//		Logger.start(true,"同步mongo-验证指令SyncBatchAgentProductStockStatus-未售完");
//		try{
//			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
//			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
//			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//			
//			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
//			
//			importagentproductCall.setData(importAgentProductBean);
//			importagentproductCall.callService();
//			
//			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
//			
//			bean.setActionType("SyncBatchAgentProductStockStatus"); 
//			//bean.setActivityId();
//			bean.setProductId(productId);
//			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
//			bean.setExtParam("[\""+agentProductId+"\"]");
//			call.setData(bean);
//			call.callService();
//			Logger.comment("#######productId:###########"+productId);
//			Logger.comment("#######agentProductId:###########"+agentProductId);
//			//验证mongo_product
//			//渠道商品
//			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
//            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
//			//代理商品
//			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
//            Logger.verifyEquals(false,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
//
//		}catch(Exception e){
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_Mongocrud_044_1() {
//		Logger.start(true,"同步mongo-验证指令SyncBatchAgentProductStockStatus-所有规格售完，同步售完");
//		try{
//			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
//			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
//			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//			
//			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
//			importagentproductCall.setData(importAgentProductBean);
//			importagentproductCall.callService();
//			
//			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
//
//			//修改库存为0
//			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
//			modifyAgentProductBean.getCatalogList().get(0).setStock(0);
//			modifyAgentProductBean.getCatalogList().get(1).setStock(0);
//			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
//			modifyAgentProductCall.setData(modifyAgentProductBean);
//			modifyAgentProductCall.callService();
//			
//			
//			bean.setActionType("SyncBatchAgentProductStockStatus"); 
//			//bean.setActivityId();
//			bean.setProductId(productId);
//			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
//			bean.setExtParam("[\""+agentProductId+"\"]");
//			call.setData(bean);
//			call.callService();
//			Thread.sleep(2000);
//			
//			Logger.comment("#######productId:###########"+productId);
//			Logger.comment("#######agentProductId:###########"+agentProductId);
//			//验证mongo_product
//			//渠道商品
//			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
//            Logger.verifyEquals(true,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
//			//代理商品
//			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
//            Logger.verifyEquals(true,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
//
//		}catch(Exception e){
//			Logger.fail(e);
//		}
//	}
//	
//	
//	
//	
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_Mongocrud_044_2() {
//		Logger.start(true,"同步mongo-验证指令SyncBatchAgentProductStockStatus-单规格售完，不同步售完");
//		try{
//			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
//			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
//			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//			
//			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
//			importagentproductCall.setData(importAgentProductBean);
//			importagentproductCall.callService();
//			
//			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
//
//			//修改库存为0
//			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
//			modifyAgentProductBean.getCatalogList().get(0).setStock(0);
//			//modifyAgentProductBean.getCatalogList().get(1).setStock(0);
//			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
//			modifyAgentProductCall.setData(modifyAgentProductBean);
//			modifyAgentProductCall.callService();
//			
//			
//			bean.setActionType("SyncBatchAgentProductStockStatus"); 
//			//bean.setActivityId();
//			bean.setProductId(productId);
//			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
//			bean.setExtParam("[\""+agentProductId+"\"]");
//			call.setData(bean);
//			call.callService();
//			Thread.sleep(2000);
//			
//			Logger.comment("#######productId:###########"+productId);
//			Logger.comment("#######agentProductId:###########"+agentProductId);
//			//验证mongo_product
//			//渠道商品
//			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
//            Logger.verifyEquals(false,(boolean)p1.get("issellout"), "验证渠道商品mongo数据库issellout(true:售完  false:未售完)");
//			//代理商品
//			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId);
//            Logger.verifyEquals(false,(boolean)p2.get("issellout"), "验证代理商品mongo数据库issellout(true:售完  false:未售完)");
//
//		}catch(Exception e){
//			Logger.fail(e);
//		}
//	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_045() {
		Logger.start(true,"同步mongo-验证指令ModifyAllAgentProductSellPrice,货头的所有代理商品销售价 -修改神器商品销售价，货头改变币种");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setCurrency("CNY");
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			
			bean.setActionType("ModifyAllAgentProductSellPrice"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(5000);
            
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			 Logger.debug("验证规格");
			 List<BigDecimal> prices=new ArrayList();
		     List<YmtCatalogsI> ymtCatalogsIList = CIWapper.selectCatalogsByProductId(agentProductId);
		        addAgentProductBean.getCatalogList().forEach(c->{
		        	// int count=ymtCatalogsIList.size();
		            for (YmtCatalogsI ymtCatalogsI:ymtCatalogsIList) {
		           
		            	 if (c.getSku().equals(ymtCatalogsI.getsSKU())){
		                     try {
		                    	Logger.comment("##########sku:"+c.getSku()+"###########");
		                    	BasicDBObject search = new BasicDBObject();
		         				search.append("sku", c.getSku());
		         				search.append("spid", agentProductId);
		         				// 验证规格相关
		         				//Map clist = mongoDB_productsWapper.selectCatalogs(search, null).get(count-1);
		         				Map clist = mongoDB_productsWapper.selectCatalogs(search, null).get(0);
		                        Logger.verifyEquals(ymtCatalogsI.getfQuotePrice().stripTrailingZeros().toPlainString()
		                        		,new BigDecimal(clist.get("price").toString()).stripTrailingZeros().toPlainString(),"验证price 渠道原始规格QuotePrice");
		                        prices.add(ymtCatalogsI.getfQuotePrice());
		                       // count--;
							} catch (Exception e) {
								e.printStackTrace();
							}  
		             }
		           }
		        });
		        
		        //比较商品最大值 最小值
		        prices.sort((a,b)->a.compareTo(b));//升序
		        Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
		        Logger.verifyEquals(true,p.get("minp").toString().contains(prices.get(0).stripTrailingZeros().toPlainString())
		        		, "验证商品最大价格minp");
		        Logger.verifyEquals(true,p.get("maxp").toString().contains(prices.get(prices.size()-1).stripTrailingZeros().toPlainString())
		        		, "验证商品最大价格maxp");
            
           
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_046() {
		Logger.start(true,"同步mongo-验证指令ModifySingleAgentProductSellPrice,修改单个神器商品销售价");
		try{
			
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();
			
			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setCurrency("CNY");
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			
			bean.setActionType("ModifySingleAgentProductSellPrice"); 
			//bean.setActivityId();
			bean.setProductId(agentProductId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
            Thread.sleep(5000);
            
			Logger.comment("#######productId:###########"+productId);
			Logger.comment("#######agentProductId:###########"+agentProductId);
			
			 Logger.debug("验证规格");
			 List<BigDecimal> prices=new ArrayList();
		     List<YmtCatalogsI> ymtCatalogsIList = CIWapper.selectCatalogsByProductId(agentProductId);
		        addAgentProductBean.getCatalogList().forEach(c->{
		        	// int count=ymtCatalogsIList.size();
		            for (YmtCatalogsI ymtCatalogsI:ymtCatalogsIList) {
		           
		            	 if (c.getSku().equals(ymtCatalogsI.getsSKU())){
		                     try {
		                    	Logger.comment("##########sku:"+c.getSku()+"###########");
		                    	BasicDBObject search = new BasicDBObject();
		         				search.append("sku", c.getSku());
		         				search.append("spid", agentProductId);
		         				// 验证规格相关
		         				//Map clist = mongoDB_productsWapper.selectCatalogs(search, null).get(count-1);
		         				Map clist = mongoDB_productsWapper.selectCatalogs(search, null).get(0);
		                        Logger.verifyEquals(ymtCatalogsI.getfQuotePrice().stripTrailingZeros().toPlainString()
		                        		,new BigDecimal(clist.get("price").toString()).stripTrailingZeros().toPlainString(),"验证price 渠道原始规格QuotePrice");
		                        prices.add(ymtCatalogsI.getfQuotePrice());
		                       // count--;
							} catch (Exception e) {
								e.printStackTrace();
							}  
		             }
		           }
		        });
		        
		        //比较商品最大值 最小值
		        prices.sort((a,b)->a.compareTo(b));//升序
		        Map<String,Object> p= mongoDB_productsWapper.getByProductId(agentProductId);
		        Logger.verifyEquals(true,p.get("minp").toString().contains(prices.get(0).stripTrailingZeros().toPlainString())
		        		, "验证商品最大价格minp");
		        Logger.verifyEquals(true,p.get("maxp").toString().contains(prices.get(prices.size()-1).stripTrailingZeros().toPlainString())
		        		, "验证商品最大价格maxp");
            
           
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//20190816 佣金变更为比例模式此case废弃
	public void Tc_Mongocrud_047() {
		Logger.start(true,"同步mongo-验证指令ChangeCatalogCommission,变更规格佣金-优选团");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			//Thread.sleep(5000);
			
			//更改礼包类型
			//请求参数增加字段：giftType: 礼包类型，1礼包商品，2优选团商品
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(globalSellerId, productId, 2);
			//Thread.sleep(5000);
			
			//查找规格
			YmtCatalogs catalogs=catalogdWapper.selectBySproductId(productId);
			List<BigDecimal> saleCommissionLis=new ArrayList();
			saleCommissionLis.add(new BigDecimal(1.111));
			saleCommissionLis.add(new BigDecimal(2.126));
			saleCommissionLis.add(new BigDecimal(3));
			saleCommissionLis.add(new BigDecimal(4));
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(globalSellerId, productId, 
					catalogs.getScatalogid(), globalSellerName, saleCommissionLis);
			Thread.sleep(5000);
			
			bean.setActionType("ChangeCatalogCommission");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");
            
            YmtProducts product=productMapper.selectProductByProductId(productId);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证commissions######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				
				if(catalogs.getScatalogid().equals(str_catalogId))
				{
				      Logger.verifyEquals(true,act.getString("commissions").equals(exp.get(0).getSaleCommissions()), "验证第"+i+"条传入的市场价commissions与mongo数据库是否一致");
				}
			}	
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//业务测试反馈这个商家铺了大量商品导致总线阻塞
	public void Tc_Mongocrud_46() {
		Logger.start(true,"同步mongo-验证指令PassiveModifyAllAgentProduct-修改所有子商品信息,修改自采商品,导入代理商品-普通代理(有子商品)");
		try{
			sellerId1=501217421;
			agentUserId1=501217422;
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,sellerId1,false);
			importagentproductCall.setData(importAgentProductBean);
			importagentproductCall.callService();

			String agentProductId = importagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			Logger.comment("#######agentProductId:###########"+agentProductId);
			Thread.sleep(5000);
			//修改
			Integer thirdCategoryId=1004;
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setThirdCategoryId(thirdCategoryId);

			String productParam="{'啊啊':'哈哈'}";
			modifyAgentProductBean.setProductParam(productParam);
			modifyAgentProductBean.setSource("pc");
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			Logger.comment("######### productId ######"+productId);
			Logger.comment("######### agentProductId ######"+agentProductId);

			bean.setActionType("PassiveModifyAllAgentProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			Thread.sleep(10000);
			//查询渠道商品
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(Integer.parseInt(p.get("tcatid").toString()), thirdCategoryId, "验证渠道返回tcatid");
			//查询代理商品
		    Map<String,Object> ap= mongoDB_productsWapper.getByProductId(agentProductId);
			Logger.verifyEquals(ap.get("tcatid").toString(), "0", "验证代理返回tcatid");
			
			ESsearchBean esbean=new ESsearchBean();
			ESGodsearchCall godCall=new ESGodsearchCall();
			//查询es渠道
			esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
		   //验证渠道商品
			EsGodProduct product=godCall.getEsProduct();
			Logger.verifyEquals(thirdCategoryId,product.getTcateid(), "验证es渠道三级分类Id修改");

			//查询es代理
			esbean.setProductId("pid:"+agentProductId);
			godCall.setData(esbean);
			godCall.callService();
		   //验证渠道商品
			EsGodProduct agentProduct=godCall.getEsProduct();
			Logger.verifyEquals(thirdCategoryId,agentProduct.getTcateid(), "验证es代理三级分类Id修改");
			Logger.verifyEquals(product.getParam(),modifyAgentProductBean.getProductParam().replace(":", " ").replace("{", "").replace("}", "").replace("'", ""), "验证返回ProductParam");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//业务测试反馈这个商家铺了大量商品导致总线阻塞
	public void Tc_Mongocrud_46_1() {
		Logger.start(true,"同步mongo-验证指令PassiveModifyAllAgentProduct-修改所有子商品信息,修改自采商品,渠道(无子商品)");
		try{
			sellerId1=501217421;
			agentUserId1=501217422;
			ImportAgentProductCall importagentproductCall=new ImportAgentProductCall();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			Thread.sleep(5000);
			//修改
			Integer thirdCategoryId=1004;
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			String productParam="{'啊啊':'哈哈'}";
			modifyAgentProductBean.setProductParam(productParam);
			modifyAgentProductBean.setSource("pc");
			
			modifyAgentProductBean.setThirdCategoryId(1004);
			modifyAgentProductBean.getCatalogList().get(0).setStock(30);
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			Logger.comment("######### productId ######"+productId);

			bean.setActionType("PassiveModifyAllAgentProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
			
			Thread.sleep(10000);
			//查询渠道商品
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(Integer.parseInt(p.get("tcatid").toString()), thirdCategoryId, "验证渠道返回tcatid");
			
			ESsearchBean esbean=new ESsearchBean();
			ESGodsearchCall godCall=new ESGodsearchCall();
			//查询es渠道
			esbean.setProductId("pid:"+productId);
			godCall.setData(esbean);
			godCall.callService();
		   //验证渠道商品
			EsGodProduct product=godCall.getEsProduct();
			Logger.verifyEquals(thirdCategoryId,product.getTcateid(), "验证es渠道三级分类Id修改");
			Logger.verifyEquals(product.getParam(),modifyAgentProductBean.getProductParam().replace(":", " ").replace("{", "").replace("}", "").replace("'", ""), "验证返回ProductParam");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_048() {
		Logger.start(true,"同步mongo-验证指令SetMemberProduct,设置/取消  优选会员商品-设置");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			//Thread.sleep(5000);
			
			ProductManagerCallServiceV3.SetMemberProduct(productId, globalSellerId, true);
			
			Thread.sleep(5000);
			
			bean.setActionType("SetMemberProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");

            Logger.verifyEquals(true,(boolean)p.get("member"),
            		"验证传入的商品类型member与mongo是否一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_048_1() {
		Logger.start(true,"同步mongo-验证指令SetMemberProduct,设置/取消  优选会员商品-取消");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			//Thread.sleep(5000);
			
			ProductManagerCallServiceV3.SetMemberProduct(productId, globalSellerId, false);
			
			Thread.sleep(5000);
			
			bean.setActionType("SetMemberProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");

            Logger.verifyEquals(false,(boolean)p.get("member"),
            		"验证传入的商品类型member与mongo是否一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_049() {
		//http://jira.ymatou.cn:8080/browse/JIRACONN-33118
		Logger.start(true,"同步mongo-验证指令AddAgentProduct,同步税率及佣金-JIRACONN-33118");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			addAgentProductBean.setTariffRate(0.091);
			addAgentProductBean.setMarketCurrency("HKD");
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setLimitNum(20);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			bean.setActionType("AddAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
			//验证限购 Catalog
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			Logger.debug("mongoc:"+FormatUtil.beanToGSONString(catalogsList));
			Logger.verifyEquals(addAgentProductBean.getCatalogList().get(0).getLimitNum(),catalogsList.get(0).getiLimitNum(), "验证返回LimitNum");
            
            BasicDBObject search = new BasicDBObject();
			search.append("sku", catalogsList.get(0).getsSKU());
			search.append("spid", productId);
			search.append("price", addAgentProductBean.getCatalogList().get(0).getDirectPrice());
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			Logger.verifyEquals(catalogsList.get(0).getiLimitNum(),Integer.parseInt(clist.get(0).get("limitnum").toString()),"验证规格limitnum");
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.debug("mongop:"+p);
			
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//同步税率市场价
			Logger.verifyEquals(addAgentProductBean.getMarketCurrency().trim(),p.get("mcurrency").toString().trim(), "验证传入的商品类型mcurrency与mongo数据库是否一致");
			Logger.verifyEquals(new BigDecimal(String.valueOf(addAgentProductBean.getTariffRate())),new BigDecimal(p.get("tarate").toString()).setScale(4).stripTrailingZeros(), "验证传入的商品类型tarate与mongo数据库是否一致");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
            //查询商品
           AddproductSearch(productId,addAgentProductBean,clist);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_050() {
		//http://jira.ymatou.cn:8080/browse/JIRACONN-33118
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,同步税率及佣金-JIRACONN-33118");
		try{
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,false);
			
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			modifyAgentProductBean.setTariffRate(0.091);
			modifyAgentProductBean.setMarketCurrency("USD");
			
			modifyAgentProductBean.getCatalogList().get(0).setLimitNum(20);
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
			//验证限购 Catalogs
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			Logger.debug("mongoc:"+FormatUtil.beanToGSONString(catalogsList));
			Logger.verifyEquals(modifyAgentProductBean.getCatalogList().get(0).getLimitNum(),catalogsList.get(0).getiLimitNum(), "验证返回LimitNum");
			
            BasicDBObject search = new BasicDBObject();
			search.append("sku", catalogsList.get(0).getsSKU());
			search.append("spid", productId);
			search.append("price", addAgentProductBean.getCatalogList().get(0).getDirectPrice());
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			Logger.verifyEquals(catalogsList.get(0).getiLimitNum(),Integer.parseInt(clist.get(0).get("limitnum").toString()),"验证规格limitnum");
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.debug("mongo:"+p);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//同步税率市场价
			Logger.verifyEquals(modifyAgentProductBean.getMarketCurrency(),p.get("mcurrency").toString(), "验证传入的商品类型mcurrency与mongo数据库是否一致");
			Logger.verifyEquals(modifyAgentProductBean.getTariffRate(),Double.valueOf(p.get("tarate").toString()), "验证传入的商品类型tarate与mongo数据库是否一致");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(sellerId1,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
            //查询商品
            ModifyproductSearch(productId,modifyAgentProductBean,clist);
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_050_1() {
		//http://jira.ymatou.cn:8080/browse/JIRACONN-33118
		Logger.start(true,"同步mongo-验证指令ModifyAgentProduct,修改拼团，同步拼团价格");
		try{
			
			Logger.comment("####创建拼团######");
			Integer mchId = GodmchManageCallService.CreateSellerMch();
		    AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId,"AutoTest",false);
		    String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
		    List<String> catalogList =new ArrayList<String>();
		    ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(mchId,productId);
		    selectProductDetails.getCatalogList().forEach(a->{
		     catalogList.add(a.getCatalogId());
		     });
		   
		    SaveGrouponReq savegrouponBean = Shop2cnGrouponCallService.initSaveGrouponReq(mchId, productId, catalogList.get(0), 100d);
		    Integer grouponProductId = Shop2cnGrouponCallService.SaveGrouponCall(savegrouponBean);
			 //查询  GrouponCatalogs
		    List<GrouponCatalogs>  gp= YmtProductsIWapper.selectGrouponCatalogs(catalogList.get(0), null);
		    //修改商品
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			modifyAgentProductBean.setTariffRate(0.05);
			modifyAgentProductBean.setMarketCurrency("USA");
			modifyAgentProductBean.getCatalogList().get(0).setLimitNum(20);
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("ModifyAgentProduct"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			
//			//验证限购 Catalogs
//			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
//			Logger.debug("mongoc:"+FormatUtil.beanToGSONString(catalogsList));
//			Logger.verifyEquals(modifyAgentProductBean.getCatalogList().get(0).getLimitNum(),catalogsList.get(0).getiLimitNum(), "验证返回LimitNum");
//			
            BasicDBObject search = new BasicDBObject();
			search.append("cid", gp.get(0).getCatalogId());
			search.append("spid", productId);
			search.append("price", addAgentProductBean.getCatalogList().get(0).getDirectPrice());
			List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
			//Logger.verifyEquals(catalogsList.get(0).getiLimitNum(),Integer.parseInt(clist.get(0).get("limitnum").toString()),"验证规格limitnum");
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.debug("mongo:"+p);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			
            Logger.verifyEquals(3,Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("agtype").toString()), "验证传入的商品类型agtype与mongo数据库是否一致");
            Logger.verifyEquals(1,Integer.parseInt(p.get("status").toString()), "验证传入的商品类型status与mongo数据库是否一致");
            Logger.verifyEquals(0,Integer.parseInt(p.get("puid").toString()), "验证传入的商品类型puid与mongo数据库是否一致");
            Logger.verifyEquals(0,p.get("ppid")==null?0:Integer.parseInt(p.get("ppid").toString()), "验证传入的商品类型ppid与mongo数据库是否一致");
            Logger.verifyEquals(mchId,Integer.parseInt(p.get("ruid").toString()), "验证传入的商品类型ruid与mongo数据库是否一致");   
            Logger.verifyEquals(productId,p.get("rpid").toString(), "验证传入的商品类型rpid与mongo数据库是否一致");
            
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), addAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            Logger.verifyEquals(ext.get("desc").toString(), addAgentProductBean.getDescription(), "验证productDescExtra表中的desc字段");
            
            checkverify_godProduct(p,productId,addAgentProductBean);
            check_godMainProduct_issellout(productId);
            
            //拼团代购价格
            Logger.verifyEquals(gp.get(0).getGrouponPrice().stripTrailingZeros().stripTrailingZeros()
            		,new BigDecimal(clist.get(0).get("goprice").toString()).stripTrailingZeros().stripTrailingZeros(),"验证拼团价格goprice 库存 "); 
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_051() {
//		新增同步字段，catalog表 
//		SaleCommissionPercent -->commissionpercent 
		//Commission  之前老版本 乘以 0.6，现在同步比例，不同步这个字段
		Logger.start(true,"同步mongo-验证指令ChangeCatalogCommission,新增商品-全球优选商品-新增字段commissionpercent-JIRACONN-33118");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			addpro.getProduct().getCatalogList().remove(0);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
			BigDecimal saleCommission=new BigDecimal(0.10).setScale(2,BigDecimal.ROUND_HALF_UP);
			ProductManagerCallServiceV2.UpdateCatalogCommisions(globalSellerId, productId, catalogsList.get(0).getsCatalogId(), addpro.getSellerName(), saleCommission);
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			bean.setActionType("ChangeCatalogCommission");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(6000);
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    Logger.comment("products:"+p);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");
            
            YmtProducts product=productMapper.selectProductByProductId(productId);
			catalogsList = CIWapper.selectCatalogsByProductId(productId);
			
			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
				//同步税率市场价
				Logger.debug("catalog:"+act.toString());
				Logger.verifyEquals(saleCommission,new BigDecimal( act.get("commissionpercent").toString()).setScale(2,BigDecimal.ROUND_HALF_UP), "验证传入的commissionpercent与mongo数据库是否一致");
			}	
			
//			ImRedisWapper imRedisWapper=new ImRedisWapper();
//			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
//			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
//			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
//			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
//			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
//			
//			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
//			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
//
//			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
//			// CST(北京时间)在东8区
//			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
//		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
//		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();
//
//			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
//			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
//			
//			
//			//查询商品
//	         GetProductInfoByProductIdBean pbean=new GetProductInfoByProductIdBean();
//	         GetProductInfoByProductIdCall pCall=new GetProductInfoByProductIdCall();
//	         pbean.setProductId(productId);
//	         pCall.setData(pbean);
//	         pCall.callService();
//	         
//	         JSONArray expCatalogArray=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product").getJSONArray("CatalogList");
//	         //计算佣金
//	         BigDecimal price=new BigDecimal(new JSONObject(expCatalogArray.get(0).toString()).getString("Price"));
//	         BigDecimal expcommission=new BigDecimal(new JSONObject(expCatalogArray.get(0).toString()).getString("Commission"));
//	         BigDecimal actcommission=price.multiply(saleCommission).multiply(new BigDecimal("0.6")).setScale(2, BigDecimal.ROUND_DOWN).stripTrailingZeros();//保留2为小数，多余的位数去掉
//
//			 Logger.verifyEquals(expcommission, actcommission, "验证查询商品中返回commissionpercent");
			  
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_052() {
//		新增同步字段，catalog表 
//		SaleComissionPercent --> comissionpercent 
		Logger.start(true,"同步mongo-验证指令ChangeCatalogCommission,全球优选商品礼包4个费率-新增字段comissionpercent-JIRACONN-33118");
		try{
			//发布一个活动商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			addpro.getProduct().getCatalogList().remove(0);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			ProductManagerCallServiceV3.UpdateGiftType(globalSellerId, productId,1);
			List<YmtCatalogsI> catalogsList = CIWapper.selectCatalogsByProductId(productId);
//			BigDecimal saleCommission=new BigDecimal(0.10).setScale(2,BigDecimal.ROUND_HALF_UP);
			List<BigDecimal> saleCommissions = Arrays.asList(new BigDecimal(0.10).setScale(2,BigDecimal.ROUND_HALF_UP),new BigDecimal(0.11).setScale(2,BigDecimal.ROUND_HALF_UP),new BigDecimal(0.12).setScale(2,BigDecimal.ROUND_HALF_UP),new BigDecimal(0.13).setScale(2,BigDecimal.ROUND_HALF_UP));
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(globalSellerId, productId, catalogsList.get(0).getsCatalogId(), addpro.getSellerName(), saleCommissions);
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			bean.setActionType("ChangeCatalogCommission");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean);
			call.callService();
			Thread.sleep(6000);
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
		    Logger.comment("products:"+p);
			Logger.verifyEquals(p.get("spid").toString(), productId, "验证返回spid");
			//ptype=2是全球优选 gtype=1 是大礼包
            Logger.verifyEquals(2,Integer.parseInt(p.get("ptype").toString()),
            		"验证传入的商品类型ptype与mongo是否一致");
            
            YmtProducts product=productMapper.selectProductByProductId(productId);
			catalogsList = CIWapper.selectCatalogsByProductId(productId);

			//规格市场价
			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
			for(int i=0;i<catelogList.size();i++)
			{
				Logger.comment("######################验证mprice######################");
				JSONObject  act=new JSONObject(catelogList.get(i).toString());
				String str_catalogId=act.getString("cid");
				List<YmtCatalogs> exp=catelogList_sql.stream()
					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
				//同步税率市场价
				Logger.debug("catalog:"+act.toString());
				String commissionpercent="";
				for (BigDecimal c : saleCommissions) {
					commissionpercent+=c.setScale(4, BigDecimal.ROUND_HALF_UP)+",";
				}
				Logger.verifyEquals(commissionpercent.substring(0, commissionpercent.length()-1),act.get("commissionpercent").toString(), "验证传入的commissionpercent与mongo数据库是否一致");
			}	
			
			ImRedisWapper imRedisWapper=new ImRedisWapper();
			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
			//Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
			
			Logger.verifyEquals(true,(long)ob.get("cut")>catalogsList.get(catalogsList.size()-1).getUpdateTime().getTime(), "验证cut规格更新时间");
			Logger.verifyEquals(true,(long)ob.get("sut")>product.getDlastupdate().getTime(), "验证sut商品更新时间");
			
			
			Map<String,Object> map2 = new ProductTimeStampWapper().getByProductId(productId);
			// CST(北京时间)在东8区
			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
		    long cut_mongo=sdf.parse(sdf.format(map2.get("cut"))).getTime();
		    long sut_mongo=sdf.parse(sdf.format(map2.get("sut"))).getTime();

			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_053() {
		Logger.start(true,"同步mongo-验证指令SyncAlhProduct,同步安利会-没有设置费率(使用sql配置表的费率 Ymt_AnlihuiRebateConfig)");
		try{
			//发布一个商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductType(3);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			ProductManagerCallServiceV3.BatchAddAlhProduct(addpro.getSellerId(),productId);
			
			bean.setActionType("SyncAlhProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean); 
			call.callService();
			YmtAnlihuiProductWrapper anlihuiProductWapper=new YmtAnlihuiProductWrapper();
			YmtAnlihuiProduct anlihuiProduct=anlihuiProductWapper.selectByProductId(productId);
//			YmtAnlihuiRebateConfigWrapper configWapper=new YmtAnlihuiRebateConfigWrapper();
//			configWapper.selectBySecondCategoryId();
		    //验证商品
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(anlihuiProduct.getId(),Integer.parseInt(p.get("alhid").toString()), "验证返回alhid");
            Logger.verifyEquals(anlihuiProduct.getPlatformRebateRate().stripTrailingZeros().toPlainString()
            		,new BigDecimal(p.get("alhprebate").toString()).stripTrailingZeros().toPlainString(), "验证传入的商品类型alhprebate与mongo数据库是否一致");
            Logger.verifyEquals(anlihuiProduct.getRebateRate().stripTrailingZeros().toPlainString(),new BigDecimal(p.get("alhsrebate").toString()).stripTrailingZeros().toPlainString(), "验证传入的商品类型alhsrebate与mongo数据库是否一致");
		
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_053_1() {
		Logger.start(true,"同步mongo-验证指令SyncAlhProduct,同步安利会-设置费率");
		try{
			//发布一个商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductType(3);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			ProductManagerCallServiceV3.BatchAddAlhProduct(addpro.getSellerId(),productId);
			//设置安利会费率
			ProductManagerCallServiceV3.SetAlhProductRebateRate(addpro.getSellerId(), productId, new BigDecimal("0.3"));
			
			bean.setActionType("SyncAlhProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean); 
			call.callService();
			YmtAnlihuiProductWrapper anlihuiProductWapper=new YmtAnlihuiProductWrapper();
			YmtAnlihuiProduct anlihuiProduct=anlihuiProductWapper.selectByProductId(productId);
			
		    //验证商品编号spid
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(anlihuiProduct.getId().toString(),p.get("alhid").toString(), "验证返回alhid");
            Logger.verifyEquals(anlihuiProduct.getRebateRate().stripTrailingZeros().toString()
            		,new BigDecimal(p.get("alhsrebate").toString()).stripTrailingZeros().toString(), "验证传入的商品类型alhsrebate与mongo数据库是否一致");
            Logger.verifyEquals(anlihuiProduct.getPlatformRebateRate().stripTrailingZeros().toString()
            		,new BigDecimal(p.get("alhprebate").toString()).stripTrailingZeros().toString(), "验证传入的商品类型alhprebate与mongo数据库是否一致");
		
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_Mongocrud_054() {
		Logger.start(true,"同步mongo-验证指令AddAgentActivityProduct,神器限时抢活动 添加活动商品(20201202排查-暂时不在此站点维护)");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();		
			
			//发布一个商品		
			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
			List<String> catalogList=new ArrayList<>();
			catalogList.add(catelogList_sql.get(0).getScatalogid());
			
			AddactivityBean addactivityBean=AgentProductCallService.initProductaddactivity(sellerId1,productId,catalogList);

			Integer activityId=AgentProductCallService.agentProductaddactivity(addactivityBean);
			Thread.sleep(5000);
			Logger.comment("#### productId #### "+productId);
			Logger.comment("#### activityProductId #### "+activityId);

			List<Map> mapLst= mongoDB_productsWapper.getActivityProductByProductId(productId);
			Logger.verifyEquals(new BigDecimal(new JSONArray(mapLst.get(0).get("catalogs").toString()).getJSONObject(0).get("discount").toString()).stripTrailingZeros().toPlainString()
					, addactivityBean.getProductList().get(0).getCatalogList().get(0).getDiscount().divide(new BigDecimal(10)).stripTrailingZeros().toPlainString(), "验证discount");
			Logger.verifyEquals("3",mapLst.get(0).get("atype").toString(), "验证atype=3");
			

		
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_055() {
		Logger.start(true,"同步mongo-验证指令UpdateAgentProductPic,更新商品图片（主图，详情图）-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			   
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改
			ModifyAgentProductBean modifyAgentProductBean=AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
			
			String pic1=addAgentProductBean.getPics().get(0);
			List<String> pics=new ArrayList<String>();
			pics.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l1.jpg");
			pics.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l2.jpg");
		//	pics.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l3.jpg");
			List<String> descPics=new ArrayList<String>();
			descPics.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_ldesc1.jpg");
			modifyAgentProductBean.setPics(pics);
			modifyAgentProductBean.setDescPicList(descPics);
			
			ModifyAgentProductCall modifyAgentProductCall=new ModifyAgentProductCall();
			modifyAgentProductCall.setData(modifyAgentProductBean);
			modifyAgentProductCall.callService();
			
			bean.setActionType("UpdateAgentProductPic"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
            
            String p1=new JSONArray(p.get("pics").toString()).get(0).toString();
            String p2=new JSONArray(p.get("pics").toString()).get(1).toString();
            Logger.verifyEquals(modifyAgentProductBean.getPics().get(0),p1, "验证传入的商品第一张主图片与mongo数据库是否一致");
            Logger.verifyEquals(modifyAgentProductBean.getPics().get(1),p2, "验证传入的商品第一张主图片与mongo数据库是否一致");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), modifyAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_056() {
		Logger.start(true,"同步mongo-验证指令UpdateAgentProductPic,更新商品图片-详情图-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			   
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改详情图片
			UpdateProductDescBean updateBean=new UpdateProductDescBean();
			UpdateProductDescCall updateCall=new UpdateProductDescCall();
			updateBean.setUserId(sellerId1);
			updateBean.setProductId(productId);
			updateBean.setDescription("详情文字_"+TestDataManager.getRandomIntNum(5));
//			updateBean.setDescPicList(Arrays.asList("http://pic1.ymatou.com/G02/shangou/M07/00/93/CgvUBVfCiVSAeWRoAAJnPjwA0tM667_n_w_xqt11111.jpg",
//					"http://pic1.ymatou.com/G02/shangou/M07/00/93/CgvUBVfCiVSAeWRoAAJnPjwA0tM667_n_w_xqt22222.jpg"));
			
			updateBean.setDescPicList(Arrays.asList("http://pic1.ymatou.com/G01/M00/41/2B/rBBlD1yYU-SAJhweAADmTO2YrBw085_1_1_o.jpg"));
			updateCall.setData(updateBean);
			updateCall.callService();
			
			bean.setActionType("UpdateAgentProductPic"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), updateBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_057() {
		Logger.start(true,"同步mongo-验证指令AddProductPics,更新商品主图-渠道");
		try{
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			   
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			
			//修改
			UpdateProductPicBean updateBean=new UpdateProductPicBean();
			UpdateProductPicCall updateCall=new UpdateProductPicCall();
			updateBean.setUserId(sellerId1);
			updateBean.setProductId(productId);
			//updateBean.setMainPicList(Arrays.asList("http://pic1.ymatou.com/G02/shangou/M07/00/93/CgvUBVfCiVSAeWRoAAJnPjwA0tM667_n_w_22222.jpg"));
			updateBean.setMainPicList(Arrays.asList("http://pic1.ymatou.com/G01/M00/41/2B/rBBlD1yYU-SAJhweAADmTO2YrBw085_1_1_o.jpg"));
			updateCall.setData(updateBean);
			updateCall.callService();
			
			bean.setActionType("AddProductPics"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
            
           String p1=new JSONArray(p.get("pics").toString()).get(0).toString();
         //   String p2=new JSONArray(p.get("pics").toString()).get(1).toString();
            Logger.verifyEquals(updateBean.getMainPicList().get(0),p1, "验证传入的商品第一张主图片与mongo数据库是否一致");
            /*Logger.verifyEquals(modifyAgentProductBean.getPics().get(1),p2, "验证传入的商品第一张主图片与mongo数据库是否一致");
            
            //productDescExtra
            Map<String,Object> ext= mongoDB_productsWapper.getProductDescExtraByProductId(productId);
            Logger.verifyEquals(new JSONArray(ext.get("descpics").toString()).get(0), modifyAgentProductBean.getDescPicList().get(0), "验证productDescExtra表中的descpics字段");*/
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_058() {
		Logger.start(true,"同步mongo-验证指令UpdateAuditStatus,审核状态");
		try{	
			//发布一个商品		
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setProductType(3);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.verifyNotNull(productId, "响应报文-商品ID");
			//修改审核状态
			ProductManagerCallServiceV3.UpdateAuditStatus(productId, 1);
			
			bean.setActionType("UpdateAuditStatus");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			
			call.setData(bean); 
			call.callService();
			
		    //验证商品审核状态
		    Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("as").toString(), "1", "验证返回审核状态");
			
//          Logger.verifyEquals(addpro.getProduct().getProductType(),Integer.parseInt(p.get("ptype").toString()), "验证传入的商品类型ptype与mongo数据库是否一致");
//            
//			//规格市场价
//			List<String> catelogList= mongoDB_productsWapper.getByPid(productId);
//			List<YmtCatalogs> catelogList_sql=new YmtCatalogsWapper().selectCatalogs(productId);
//			Logger.verifyEquals(addpro.getProduct().getCatalogList().size(),catelogList.size(),"验证传入的规格 与mongo一致");
//			for(int i=0;i<catelogList.size();i++)
//			{
//				Logger.comment("######################验证mprice######################");
//				JSONObject  act=new JSONObject(catelogList.get(i).toString());
//				String str_catalogId=act.getString("cid");
//				List<YmtCatalogs> exp=catelogList_sql.stream()
//					.filter(c->c.getScatalogid().equals(str_catalogId)).collect(Collectors.toList());
//				Logger.verifyEquals(Double.parseDouble(exp.get(0).getFMarketPrice().toString()),act.getDouble("mprice"), "验证第"+i+"条传入的市场价mprice与mongo数据库是否一致");
//			}	
//            
//			ImRedisWapper imRedisWapper=new ImRedisWapper();
//			JSONObject ob=new JSONObject(imRedisWapper.getproductById(productId));
//			Logger.verifyNotNull(ob.get("cut"), "验证cut规格更新时间不为空");
//			Logger.verifyNotNull(ob.get("sut"), "验证sut商品更新时间不为空");
//			Logger.verifyEquals("null",ob.get("lut").toString(), "验证lut直播商品更新时间");
//			Logger.verifyEquals("null",ob.get("aut").toString(), "验证aut活动商品更新时间为空");
//			
//			
//			System.out.println("Redis cut:"+sdf.format(new Date(Long.valueOf(ob.get("cut").toString()))));
//			System.out.println("Redis sut:"+sdf.format(new Date(Long.valueOf(ob.get("sut").toString()))));
//
//			Map<String,Object> map = new ProductTimeStampWapper().getByProductId(productId);
//			// CST(北京时间)在东8区
//			sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
//		    long cut_mongo=sdf.parse(sdf.format(map.get("cut"))).getTime();
//		    long sut_mongo=sdf.parse(sdf.format(map.get("sut"))).getTime();
//		    
//			System.out.println("mongo cut:"+sdf.format(map.get("cut")));
//			System.out.println("mongo sut:"+sdf.format(map.get("sut")));
//
//			Logger.verifyEquals((long)ob.get("cut"),cut_mongo, "验证redis cut规格更新时间与mongo一致");
//			Logger.verifyEquals((long)ob.get("sut"),sut_mongo, "验证redis sut规格更新时间与mongo一致");
//			//拼邮发货类型
//            YmtProducts product=productMapper.selectProductByProductId(productId); productMapper.selectProductByProductId(productId);
//            Logger.verifyEquals(p.get("pdt"),product.getPackageDeliveryType(), "验证数据库ymtproduct拼邮发货类型与mongo一致");
    		
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_059() {
		Logger.start(true,"同步mongo-验证指令UpdateShowStatus,更新商品露出状态-visible=false,导入代理商品-渠道");
		try{
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//更新商品露出状态
			//visible  接口赋值与数据库相反
			//sql、mongo中是是否隐藏，es 表示意思是是否可见，所以sql、mongo与es意思相反，值也相反
			AddAgentProductCallService.SetVisible(sellerId1, Lists.newArrayList(productId), false);
			
			bean.setActionType("UpdateShowStatus"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("invis").toString(), "true", "验证返回invis");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Mongocrud_059_1() {
		Logger.start(true,"同步mongo-验证指令UpdateShowStatus,更新商品露出状态-visible=true,导入代理商品-渠道");
		try{
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId1,sellerName1,true);
			addAgentProductBean.getCatalogList().remove(0);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(10);//神器市场价 新增 20200325
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			//更新商品露出状态
			//visible sql中是是否可见，mongo和es 表示意思是是否隐藏，所以sql与mongo意思相反，值也相反+
			AddAgentProductCallService.SetVisible(sellerId1, Lists.newArrayList(productId), true);
			
			bean.setActionType("UpdateShowStatus"); 
			//bean.setActivityId();
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			//bean.setExtParam(gp.get(0).getVersion().toString());
			call.setData(bean);
			call.callService();
			Thread.sleep(5000);
			//验证mongo_product
			Map<String,Object> p= mongoDB_productsWapper.getByProductId(productId);
			Logger.verifyEquals(p.get("invis").toString(), "false", "验证返回invis");
            
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	private void checkverify_godProduct(Map<String,Object> p,String productId,AddAgentProductBean addAgentProductBean) throws Exception
	{
		//ymt_product 与 mongo_product 比较
        Map<String,Object> pmap = ipm.selectProductByProdId(productId);
        YmtProductsI YmtProductsI=YmtProductsIWapper.selectProductByProductId(productId).get(0);
        Logger.verifyEquals(Integer.parseInt(pmap.get("CardInfo").toString()),Integer.parseInt(p.get("card").toString()), "验证传入的商品类型card与mongo数据库是否一致");
        Logger.verifyEquals(Integer.parseInt(pmap.get("iCatalogStatus").toString()),Integer.parseInt(p.get("deliv").toString()), "验证传入的商品类型RootProductId与mongo数据库是否一致");
      
       //ymt_AgentProducts  与 mongo_product 比较
        AgentProductPo agentProductPo= YmtProductsIWapper.selectAgentProductByProductId(productId);
        Logger.verifyEquals(agentProductPo.getInfoProgress(),Integer.parseInt(p.get("infop").toString()), "验证传入的商品类型infop与mongo数据库是否一致");
        Logger.verifyEquals(agentProductPo.getAgentChain(),p.get("achain").toString(), "验证传入的代理关系achain与mongo数据库是否一致");
        Logger.verifyEquals(agentProductPo.getCurrency(),p.get("currency").toString(), "验证currency与mongo数据库是否一致");
        //是否是自提
        Logger.verifyEquals(agentProductPo.getCollectionGoods(),(boolean)p.get("colgoods"), "验证collectionGoods与mongo数据库是否一致");
        //快递配送
        Logger.verifyEquals(agentProductPo.getExpressDelivery(),(boolean)p.get("expdel"), "验证expressDelivery与mongo数据库是否一致");
        //最小起购数量
        Logger.verifyEquals(agentProductPo.getMinOrderNum(),Integer.parseInt(p.get("moq").toString()), "验证MinOrderNum与mongo数据库是否一致");
        
        Logger.comment(" ####currency:#### "+p.get("currency"));
        //Ymt_Catalogs  与 mongo_product 比较
        Logger.debug("验证规格");
     
        List<YmtCatalogsI> ymtCatalogsIList = CIWapper.selectCatalogsByProductId(productId);
        addAgentProductBean.getCatalogList().forEach(c->{
            
            for (YmtCatalogsI ymtCatalogsI:ymtCatalogsIList) {
            	 if (c.getSku().equals(ymtCatalogsI.getsSKU()) && new BigDecimal(c.getDirectPrice()).stripTrailingZeros().equals(ymtCatalogsI.getfQuotePrice().stripTrailingZeros()) ){
            		 
                     try {
                    	Logger.comment("##########sku:"+c.getSku()+"###########");
                    	BasicDBObject search = new BasicDBObject();
         				search.append("sku", c.getSku());
         				search.append("spid", productId);
         				search.append("price", c.getDirectPrice());
         				
         				// 验证规格相关
         				List<Map> clist = mongoDB_productsWapper.selectCatalogs(search, null);
						Logger.verifyEquals(ymtCatalogsI.getParentCatalogId(),clist.get(0).get("pcid")==null?null:clist.get(0).get("pcid").toString(),"验证pcid 上级规格id");
                        Logger.verifyEquals(ymtCatalogsI.getRootCatalogId(),clist.get(0).get("rcid").toString(),"验证rcid 渠道原始规格Id");
                        Logger.verifyEquals(ymtCatalogsI.getfQuotePrice().stripTrailingZeros().toString(),new BigDecimal(clist.get(0).get("price").toString()).stripTrailingZeros().toString(),"验证price 渠道原始规格QuotePrice");
                        Logger.verifyEquals(ymtCatalogsI.getsPicUrl(),clist.get(0).get("catapic").toString(),"验证规格price");
                        
                        
                        //若是自采商品，stock=实际库存;若是代理，stock=0
                        int stock=Integer.parseInt(p.get("agtype").toString())==0?c.getStock():0;
                        Logger.verifyEquals(stock,Integer.parseInt(clist.get(0).get("stock").toString()),"验证库存stock 库存 ");

                        Logger.verifyEquals(c.getMarketAmount(), Double.parseDouble(clist.get(0).get("marketamt").toString()), "验证规格市场价marketamt");//神器市场价 新增 20200325
                        //
                        
					} catch (Exception e) {
						e.printStackTrace();
					}  
             }
           }
        }); 
	}
	/**
	 * 验证渠道商品是否售完
	 * @param productId
	 * @throws Exception
	 */
	private void check_godMainProduct_issellout(String productId,String... agentProductId) throws Exception
	{
		 //验证是否渠道售完
        int inum=0;//规格上的库存
        BasicDBObject search = new BasicDBObject();
		search.append("spid", productId);
		List<Map> clist =mongoDB_productsWapper.selectCatalogs(search, null);
		for(int i=0;i<clist.size();i++)
		{
			inum = Integer.parseInt(clist.get(i).get("stock").toString());
		}
		Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);

        Logger.verifyEquals(inum==0?true:false,(boolean)p1.get("issellout"),"验证monogo 商品表是否售完字段 issellout ");
        if(agentProductId.length>0){
			Map<String,Object> p2= mongoDB_productsWapper.getByProductId(agentProductId[0]);
	        Logger.verifyEquals(inum==0?true:false,(boolean)p2.get("issellout"),"验证monogo 商品表是否售完字段 issellout ");
        }
        
        //验证非境内商品
        Logger.verifyEquals(p1.get("domestic").toString(), Integer.parseInt(p1.get("ruid").toString())==this.domestic_sellerId?"true":"false", "验证productDescExtra表中的domestic字段");
        
	}
	/**
	 * 创建商品
	 * @param productId
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	private void createProduct_sync(String productId) throws ClientProtocolException, IOException
	{
		bean.setActionType("CreateProduct");
		bean.setActivityId(0);
		bean.setProductId(productId);
		bean.setTransactionId(TestDataManager.getRandomIntNum(9));
		call.setData(bean);
		call.callService();
	}
	/**
	 * 创建自采商品
                 导入代理商品
	 * @param productId
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	 private void AddAgentProduct_sync(String productId) throws ClientProtocolException, IOException
	 {
			bean.setActionType("AddAgentProduct");
			bean.setActivityId(0);
			bean.setProductId(productId);
			bean.setTransactionId(TestDataManager.getRandomIntNum(9));
			call.setData(bean);
			call.callService();
	 }
	 
	 private void AddproductSearch(String productId,AddAgentProductBean addAgentProductBean,List<Map> clist) throws JSONException, ClientProtocolException, IOException{
		//查询商品
         GetProductInfoByProductIdBean pbean=new GetProductInfoByProductIdBean();
         GetProductInfoByProductIdCall pCall=new GetProductInfoByProductIdCall();
         pbean.setProductId(productId);
       //  pbean.setNextActivityExpire(1);
         pCall.setData(pbean);
         pCall.callService();
         JSONArray expCatalogArray=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product").getJSONArray("CatalogList");
         JSONObject expCurrencyObject=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product").getJSONObject("MarketCurrencyExchangeRate");
         JSONObject expProductObject=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product");
         
		 Logger.verifyEquals(new JSONObject(expCatalogArray.get(0).toString()).getString("LimitNum"), clist.get(0).get("limitnum").toString(), "验证查询商品中返回limitnum");
		 Logger.verifyEquals(Double.parseDouble(expProductObject.getString("TariffRate")),addAgentProductBean.getTariffRate(), "验证查询商品中返回TariffRate");
			//MarketCurrency
		 Logger.verifyEquals(new JSONObject(expCurrencyObject.toString()).getString("Currency"),addAgentProductBean.getMarketCurrency(), "验证查询商品中返回MarketCurrencyExchangeRate中的MarketCurrency");
	 }
	 
	 private void ModifyproductSearch(String productId,ModifyAgentProductBean addAgentProductBean,List<Map> clist) throws JSONException, ClientProtocolException, IOException{
		//查询商品
         GetProductInfoByProductIdBean pbean=new GetProductInfoByProductIdBean();
         GetProductInfoByProductIdCall pCall=new GetProductInfoByProductIdCall();
         pbean.setProductId(productId);
       //  pbean.setNextActivityExpire(1);
         pCall.setData(pbean);
         pCall.callService();
         JSONArray expCatalogArray=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product").getJSONArray("CatalogList");
         JSONObject expCurrencyObject=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product").getJSONObject("MarketCurrencyExchangeRate");
         JSONObject expProductObject=new JSONObject(pCall.getReturnData()).getJSONObject("Data").getJSONObject("Product");
         
		 Logger.verifyEquals(new JSONObject(expCatalogArray.get(0).toString()).getString("LimitNum"), clist.get(0).get("limitnum").toString(), "验证查询商品中返回limitnum");
		 Logger.verifyEquals(Double.parseDouble(expProductObject.getString("TariffRate")),addAgentProductBean.getTariffRate(), "验证查询商品中返回TariffRate");
			//MarketCurrency
		 Logger.verifyEquals(new JSONObject(expCurrencyObject.toString()).getString("Currency"),addAgentProductBean.getMarketCurrency(), "验证查询商品中返回MarketCurrencyExchangeRate中的MarketCurrency");
	 }
	 
	 
	   /**
		 * 验证越洋店铺小视频
		 * @param productId
		 * @throws Exception
		 */
		private void check_godVideo(String productId,AddAgentProductBean addAgentProductBean) throws Exception
		{
			 //验证是否渠道售完
			Map<String,Object> p1= mongoDB_productsWapper.getByProductId(productId);
			JSONObject jsonObject=new JSONObject(p1.get("v").toString());
			
		    Logger.verifyEquals(addAgentProductBean.getVideo().getPic(),jsonObject.get("p"),"验证monogo 商品表小视频url");
		    Logger.verifyEquals(addAgentProductBean.getVideo().getHeight(),jsonObject.get("h"),"验证monogo 商品表小视频Height");
		    Logger.verifyEquals(addAgentProductBean.getVideo().getSize(),jsonObject.get("s"),"验证monogo 商品表小视频Size");
		    Logger.verifyEquals(addAgentProductBean.getVideo().getLength(),jsonObject.get("l"),"验证monogo 商品表小视频Length");
		    Logger.verifyEquals(addAgentProductBean.getVideo().getUrl(),jsonObject.get("u"),"验证monogo 商品表小视频Url");
		    Logger.verifyEquals(addAgentProductBean.getVideo().getWidth(),jsonObject.get("w"),"验证monogo 商品表小视频Width");
	        
		}
}
